diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4910bfc92..98508fdbe 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -97,6 +97,7 @@ jobs: NEXT_PUBLIC_API_URL: ${{ vars.NEXT_PUBLIC_API_URL }} PUBLIC_SITE_URL: ${{ vars.NEXT_PUBLIC_SITE_URL }} PUBLIC_API_URL: ${{ vars.NEXT_PUBLIC_API_URL }} + PUBLIC_AUTH_URL: ${{ vars.NEXT_PUBLIC_AUTH_URL }} steps: - uses: actions/checkout@v4 - name: Set up Node ${{ needs.get-node-version.outputs.node-version }} diff --git a/apps/cyberstorm-remix/.env b/apps/cyberstorm-remix/.env index a183166fc..41e39324b 100644 --- a/apps/cyberstorm-remix/.env +++ b/apps/cyberstorm-remix/.env @@ -1,5 +1,6 @@ -PUBLIC_SITE_URL=http://thunderstore.temp -PUBLIC_API_URL=http://thunderstore.temp +PUBLIC_SITE_URL=https://thunderstore.io +PUBLIC_API_URL=https://thunderstore.io +PUBLIC_AUTH_URL=https://auth.thunderstore.io AUTH_ENABLED= AUTH_SECRET=development PUBLIC_AUTH_BASE_URL=https://auth.thunderstore.io/auth/login diff --git a/apps/cyberstorm-remix/README.md b/apps/cyberstorm-remix/README.md index b59422122..ff384270a 100644 --- a/apps/cyberstorm-remix/README.md +++ b/apps/cyberstorm-remix/README.md @@ -39,5 +39,6 @@ yarn workspace @thunderstore/cyberstorm-remix dev --port 3000 --host 0.0.0.0 ``` PUBLIC_SITE_URL=http://thunderstore.temp PUBLIC_API_URL=http://thunderstore.temp:81 +PUBLIC_AUTH_URL=http://auth.thunderstore.temp:81 ``` 6. Run the Nimbus project normally diff --git a/apps/cyberstorm-remix/app/root.tsx b/apps/cyberstorm-remix/app/root.tsx index d221ebbd1..e73d7888f 100644 --- a/apps/cyberstorm-remix/app/root.tsx +++ b/apps/cyberstorm-remix/app/root.tsx @@ -84,6 +84,7 @@ export async function loader() { envStuff: { ENV: getPublicEnvVariables([ "PUBLIC_API_URL", + "PUBLIC_AUTH_URL", "PUBLIC_CLIENT_SENTRY_DSN", "PUBLIC_SITE_URL", ]), diff --git a/apps/cyberstorm-remix/cyberstorm/security/publicEnvVariables.ts b/apps/cyberstorm-remix/cyberstorm/security/publicEnvVariables.ts index 5ff76c2a9..62909727e 100644 --- a/apps/cyberstorm-remix/cyberstorm/security/publicEnvVariables.ts +++ b/apps/cyberstorm-remix/cyberstorm/security/publicEnvVariables.ts @@ -6,6 +6,7 @@ type rootLoaderType = { envStuff: { ENV: { PUBLIC_API_URL?: string; + PUBLIC_AUTH_URL?: string; PUBLIC_CLIENT_SENTRY_DSN?: string; PUBLIC_SITE_URL?: string; }; @@ -20,6 +21,8 @@ export const isRootLoaderData = (obj: unknown): obj is rootLoaderType => isRecord(obj.root.envStuff.ENV) && (typeof obj.root.envStuff.ENV.PUBLIC_API_URL === "string" || typeof obj.root.envStuff.ENV.PUBLIC_API_URL === "undefined") && + (typeof obj.root.envStuff.ENV.PUBLIC_AUTH_URL === "string" || + typeof obj.root.envStuff.ENV.PUBLIC_AUTH_URL === "undefined") && (typeof obj.root.envStuff.ENV.PUBLIC_CLIENT_SENTRY_DSN === "string" || typeof obj.root.envStuff.ENV.PUBLIC_CLIENT_SENTRY_DSN === "undefined") && (typeof obj.root.envStuff.ENV.PUBLIC_SITE_URL === "string" || @@ -28,6 +31,7 @@ export const isRootLoaderData = (obj: unknown): obj is rootLoaderType => export type publicEnvVariablesKeys = | "SITE_URL" | "API_URL" + | "AUTH_URL" | "CLIENT_SENTRY_DSN"; export type PublicPrefix = `PUBLIC_${envVariable}`; diff --git a/apps/cyberstorm-remix/cyberstorm/utils/ThunderstoreAuth.tsx b/apps/cyberstorm-remix/cyberstorm/utils/ThunderstoreAuth.tsx index 85dc1bdd4..7024d62d5 100644 --- a/apps/cyberstorm-remix/cyberstorm/utils/ThunderstoreAuth.tsx +++ b/apps/cyberstorm-remix/cyberstorm/utils/ThunderstoreAuth.tsx @@ -6,12 +6,10 @@ interface Props { } export function buildAuthLoginUrl(props: Props) { - const PUBLIC_API_URL = getPublicEnvVariables([ - "PUBLIC_API_URL", - ]).PUBLIC_API_URL; - return `${PUBLIC_API_URL}/auth/login/${props.type}/${ + const envVars = getPublicEnvVariables(["PUBLIC_AUTH_URL", "PUBLIC_API_URL"]); + return `${envVars.PUBLIC_AUTH_URL}/auth/login/${props.type}/${ props.nextUrl ? `?next=${encodeURIComponent(props.nextUrl)}` - : `?next=${encodeURIComponent(`${PUBLIC_API_URL}/communities/`)}` + : `?next=${encodeURIComponent(`${envVars.PUBLIC_API_URL}/communities/`)}` }`; } diff --git a/tools/visual-diff-ci/run_ci_script.py b/tools/visual-diff-ci/run_ci_script.py index 1f8e98ac4..40462d815 100644 --- a/tools/visual-diff-ci/run_ci_script.py +++ b/tools/visual-diff-ci/run_ci_script.py @@ -139,6 +139,7 @@ def start_frontend() -> BgProcess: configs = { "PUBLIC_SITE_URL": "http://127.0.0.1:8000", "PUBLIC_API_URL": "http://127.0.0.1:8000", + "PUBLIC_AUTH_URL": "http://127.0.0.1:8000", } process = BgProcess( [YARN_PATH, "workspace", "@thunderstore/cyberstorm-remix", "start", "--host", "0.0.0.0", "--port", "3000"],