Skip to content

Chava/replace proxy #79

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 25, 2025
Merged

Chava/replace proxy #79

merged 5 commits into from
Jun 25, 2025

Conversation

salvador-barboza
Copy link
Collaborator

No description provided.

@Copilot Copilot AI review requested due to automatic review settings June 25, 2025 19:27
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR replaces local development proxies with GitHub API endpoints and adds authentication for proxy requests.

  • Introduce GITHUB_API_URL and remove fallback for GITHUB_RUNTIME_PERMANENT_NAME
  • Add addGitHubAuth helper to attach Authorization headers to proxied requests
  • Update proxy rules: route / _spark/llm to GitHub’s models API and wildcard / _spark/* to GitHub API with path rewrites
Comments suppressed due to low confidence (1)

vite.config.ts:88

  • [nitpick] The path rewrite logic is non-trivial; consider adding a comment explaining how serviceName is extracted and why the rewrite target uses /runtime/${GITHUB_RUNTIME_PERMANENT_NAME}/${serviceName}.
        rewrite: (path) => {

const extraPlugins: PluginOption[] = [];

const GITHUB_RUNTIME_PERMANENT_NAME = process.env.GITHUB_RUNTIME_PERMANENT_NAME || process.env.CODESPACE_NAME?.substring(0, 20);
const GITHUB_RUNTIME_PERMANENT_NAME = process.env.GITHUB_RUNTIME_PERMANENT_NAME
Copy link
Preview

Copilot AI Jun 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing the fallback to CODESPACE_NAME may result in undefined runtime paths if the env var is missing. Consider restoring a fallback or explicitly validating and throwing an error when GITHUB_RUNTIME_PERMANENT_NAME isn’t set.

Suggested change
const GITHUB_RUNTIME_PERMANENT_NAME = process.env.GITHUB_RUNTIME_PERMANENT_NAME
const GITHUB_RUNTIME_PERMANENT_NAME = process.env.GITHUB_RUNTIME_PERMANENT_NAME;
if (!GITHUB_RUNTIME_PERMANENT_NAME) {
throw new Error("Environment variable GITHUB_RUNTIME_PERMANENT_NAME is required but not set.");
}

Copilot uses AI. Check for mistakes.

const projectRoot = process.env.PROJECT_ROOT || import.meta.dirname

const addGitHubAuth = (proxy, options) => {
Copy link
Preview

Copilot AI Jun 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The addGitHubAuth function parameters are untyped. For clarity and future maintenance, add appropriate TypeScript types (for example, proxy: Proxy, options?: ProxyOptions).

Copilot uses AI. Check for mistakes.

@salvador-barboza salvador-barboza merged commit 364246e into staging Jun 25, 2025
3 checks passed
@salvador-barboza salvador-barboza deleted the chava/replace-proxy branch June 25, 2025 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant