From 2280a7192dbb4d399db1740807d2b681e7008a85 Mon Sep 17 00:00:00 2001 From: solufa Date: Sun, 15 Sep 2024 10:32:28 +0900 Subject: [PATCH] fix: change ssl proxy port --- client/pages/_app.page.tsx | 2 +- server/api/public/defaults/controller.ts | 2 ++ server/common/types/api.ts | 1 + server/package.json | 2 +- server/service/envValues.ts | 2 ++ 5 files changed, 7 insertions(+), 2 deletions(-) diff --git a/client/pages/_app.page.tsx b/client/pages/_app.page.tsx index 9d7aad0..8431bb1 100644 --- a/client/pages/_app.page.tsx +++ b/client/pages/_app.page.tsx @@ -31,7 +31,7 @@ function MyApp({ Component, pageProps }: AppProps) { loginWith: { email: true, oauth: { - domain: 'localhost:5052', + domain: defaults.oauthDomain, scopes: ['openid'], redirectSignIn: [location.origin], redirectSignOut: [location.origin], diff --git a/server/api/public/defaults/controller.ts b/server/api/public/defaults/controller.ts index 1409777..a0c56ba 100644 --- a/server/api/public/defaults/controller.ts +++ b/server/api/public/defaults/controller.ts @@ -4,6 +4,7 @@ import { DEFAULT_USER_POOL_ID, REGION, SECRET_KEY, + SSL_PORT, } from 'service/envValues'; import { defineController } from './$relay'; @@ -16,6 +17,7 @@ export default defineController(() => ({ region: REGION, accessKey: ACCESS_KEY, secretKey: SECRET_KEY, + oauthDomain: `localhost:${SSL_PORT}`, }, }), })); diff --git a/server/common/types/api.ts b/server/common/types/api.ts index e0efb43..9f62db2 100644 --- a/server/common/types/api.ts +++ b/server/common/types/api.ts @@ -6,4 +6,5 @@ export type DefaultConfigs = { region: string; accessKey: string; secretKey: string; + oauthDomain: string; }; diff --git a/server/package.json b/server/package.json index 8067ea7..eea8efd 100644 --- a/server/package.json +++ b/server/package.json @@ -20,7 +20,7 @@ "start": "npm run start:client & npm run start:server & npm run start:ssl", "start:client": "serve ../client/out -l $CLIENT_PORT", "start:server": "prisma migrate deploy && node --enable-source-maps prisma/seed.js && node --enable-source-maps index.js", - "start:ssl": "local-ssl-proxy --key ./certificates/server.key --cert ./certificates/server.crt --source $SSL_PORT --target $CLIENT_PORT", + "start:ssl": "local-ssl-proxy --key ./certificates/server.key --cert ./certificates/server.crt --source $SSL_PORT --target $PORT", "test": "vitest run --coverage", "typecheck": "tsc --noEmit" }, diff --git a/server/service/envValues.ts b/server/service/envValues.ts index 18619d6..8c8fb02 100644 --- a/server/service/envValues.ts +++ b/server/service/envValues.ts @@ -7,6 +7,7 @@ dotenv.config(); const APP_VERSION = `v${z.string().parse(rootPackage.version)}`; const PORT = +z.string().regex(/^\d+$/).parse(process.env.PORT); +const SSL_PORT = +z.string().regex(/^\d+$/).parse(process.env.SSL_PORT); const SMTP_HOST = z.string().parse(process.env.SMTP_HOST); const SMTP_PASS = z.string().parse(process.env.SMTP_PASS); const SMTP_PORT = +z.string().regex(/^\d+$/).parse(process.env.SMTP_PORT); @@ -31,4 +32,5 @@ export { SMTP_PASS, SMTP_PORT, SMTP_USER, + SSL_PORT, };