Skip to content

Commit b208945

Browse files
committed
chore(oauth): make dev-server https conditional on local mkcert certs; gitignore them
The server.https config now enables only when webapp/localhost*.pem exist, so a normal 'vite dev' without the certs stays plain http; the certs are gitignored.
1 parent a39670e commit b208945

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,3 +94,6 @@ ngrok.local.yml
9494
# mcp-publisher auth tokens
9595
/.mcpregistry_github_token
9696
/.mcpregistry_registry_token
97+
98+
# local mkcert certs for OAuth browser-extension https testing (webapp/vite.config.ts)
99+
/webapp/localhost*.pem

webapp/vite.config.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@ import { sentryVitePlugin } from '@sentry/vite-plugin';
1414
const billingFrontendDir = resolve(__dirname, '../../billing/frontend');
1515
const hasBilling = existsSync(billingFrontendDir);
1616

17+
// Optional trusted HTTPS for local OAuth browser-extension testing (chrome.identity requires HTTPS).
18+
// Generate with `mkcert localhost` in webapp/; without the files the dev server stays plain http.
19+
const localCert = resolve(__dirname, 'localhost.pem');
20+
const localCertKey = resolve(__dirname, 'localhost-key.pem');
21+
const devHttps =
22+
existsSync(localCert) && existsSync(localCertKey)
23+
? { cert: localCert, key: localCertKey }
24+
: undefined;
25+
1726
export default defineConfig(({ mode }) => {
1827
process.env = { ...process.env, ...loadEnv(mode, process.cwd()) };
1928

@@ -78,7 +87,7 @@ export default defineConfig(({ mode }) => {
7887
exclude: ['@tginternal/library'],
7988
},
8089
server: {
81-
https: { cert: 'localhost.pem', key: 'localhost-key.pem' },
90+
https: devHttps,
8291
// this ensures that the browser opens upon server start
8392
open: true,
8493
host: process.env.VITE_HOST || undefined,

0 commit comments

Comments
 (0)