-
Notifications
You must be signed in to change notification settings - Fork 1
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
Conversation
There was a problem hiding this 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 forGITHUB_RUNTIME_PERMANENT_NAME
- Add
addGitHubAuth
helper to attachAuthorization
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 |
There was a problem hiding this comment.
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.
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) => { |
There was a problem hiding this comment.
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.
No description provided.