diff --git a/.env.example b/.env.example index 83dd4c39bb..4db2b2d4fa 100644 --- a/.env.example +++ b/.env.example @@ -7,4 +7,4 @@ # T3CODE_CLERK_PUBLISHABLE_KEY=pk_test_... # Get this from your relay deployment. `infra/relay` deploys update it automatically. -# T3_RELAY_URL=https://relay.example.com +# T3CODE_RELAY_URL=https://relay.example.com diff --git a/.github/workflows/deploy-relay.yml b/.github/workflows/deploy-relay.yml index 351942a1f9..1ce9b21986 100644 --- a/.github/workflows/deploy-relay.yml +++ b/.github/workflows/deploy-relay.yml @@ -29,8 +29,8 @@ jobs: PLANETSCALE_ORGANIZATION: ${{ vars.PLANETSCALE_ORGANIZATION }} AXIOM_TOKEN: ${{ secrets.AXIOM_TOKEN }} AXIOM_ORG_ID: ${{ vars.AXIOM_ORG_ID }} - T3_RELAY_DOMAIN: ${{ vars.T3_RELAY_DOMAIN }} - T3_RELAY_ZONE_NAME: ${{ vars.T3_RELAY_ZONE_NAME }} + T3CODE_RELAY_DOMAIN: ${{ vars.T3CODE_RELAY_DOMAIN }} + T3CODE_RELAY_ZONE_NAME: ${{ vars.T3CODE_RELAY_ZONE_NAME }} T3CODE_CLERK_PUBLISHABLE_KEY: ${{ vars.T3CODE_CLERK_PUBLISHABLE_KEY }} CLERK_SECRET_KEY: ${{ secrets.CLERK_SECRET_KEY }} APNS_ENVIRONMENT: ${{ vars.APNS_ENVIRONMENT }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cc901a2c58..50700d77ae 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -178,7 +178,7 @@ jobs: clerk_publishable_key: ${{ steps.public_config.outputs.clerk_publishable_key }} relay_url: ${{ steps.public_config.outputs.relay_url }} env: - T3_RELAY_DOMAIN: ${{ vars.T3_RELAY_DOMAIN }} + T3CODE_RELAY_DOMAIN: ${{ vars.T3CODE_RELAY_DOMAIN }} T3CODE_CLERK_PUBLISHABLE_KEY: ${{ vars.T3CODE_CLERK_PUBLISHABLE_KEY }} steps: - id: public_config @@ -188,7 +188,7 @@ jobs: set -euo pipefail required=( - T3_RELAY_DOMAIN + T3CODE_RELAY_DOMAIN T3CODE_CLERK_PUBLISHABLE_KEY ) missing=() @@ -203,7 +203,7 @@ jobs: fi echo "clerk_publishable_key=$T3CODE_CLERK_PUBLISHABLE_KEY" >> "$GITHUB_OUTPUT" - echo "relay_url=https://$T3_RELAY_DOMAIN" >> "$GITHUB_OUTPUT" + echo "relay_url=https://$T3CODE_RELAY_DOMAIN" >> "$GITHUB_OUTPUT" build: name: Build ${{ matrix.label }} @@ -213,7 +213,7 @@ jobs: timeout-minutes: 30 env: T3CODE_CLERK_PUBLISHABLE_KEY: ${{ needs.relay_public_config.outputs.clerk_publishable_key }} - T3_RELAY_URL: ${{ needs.relay_public_config.outputs.relay_url }} + T3CODE_RELAY_URL: ${{ needs.relay_public_config.outputs.relay_url }} strategy: fail-fast: false matrix: @@ -473,7 +473,7 @@ jobs: id-token: write env: T3CODE_CLERK_PUBLISHABLE_KEY: ${{ needs.relay_public_config.outputs.clerk_publishable_key }} - T3_RELAY_URL: ${{ needs.relay_public_config.outputs.relay_url }} + T3CODE_RELAY_URL: ${{ needs.relay_public_config.outputs.relay_url }} steps: - name: Checkout uses: actions/checkout@v6 @@ -628,7 +628,7 @@ jobs: timeout-minutes: 10 env: T3CODE_CLERK_PUBLISHABLE_KEY: ${{ needs.relay_public_config.outputs.clerk_publishable_key }} - T3_RELAY_URL: ${{ needs.relay_public_config.outputs.relay_url }} + T3CODE_RELAY_URL: ${{ needs.relay_public_config.outputs.relay_url }} VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} @@ -696,7 +696,7 @@ jobs: "${vercel_scope_args[@]}" \ --build-env "APP_VERSION=${{ needs.preflight.outputs.version }}" \ --build-env "T3CODE_CLERK_PUBLISHABLE_KEY=${T3CODE_CLERK_PUBLISHABLE_KEY:-}" \ - --build-env "T3_RELAY_URL=${T3_RELAY_URL:-}" \ + --build-env "T3CODE_RELAY_URL=${T3CODE_RELAY_URL:-}" \ --build-env "VITE_HOSTED_APP_URL=$router_url" \ --build-env "VITE_HOSTED_APP_CHANNEL=$channel_name" )" diff --git a/apps/mobile/README.md b/apps/mobile/README.md index fefd9491a3..37318c49b4 100644 --- a/apps/mobile/README.md +++ b/apps/mobile/README.md @@ -67,7 +67,7 @@ The native lint task runs SwiftLint for Swift plus ktlint and detekt for Kotlin. CI uses Expo fingerprinting with the `preview:dev` profile to reuse an existing compatible build when possible, or start a new internal EAS build when native runtime inputs change. Production and default local builds continue to use the `appVersion` runtime policy. -For preview or production EAS environments, set `T3CODE_CLERK_PUBLISHABLE_KEY` and `T3_RELAY_URL` +For preview or production EAS environments, set `T3CODE_CLERK_PUBLISHABLE_KEY` and `T3CODE_RELAY_URL` as EAS environment variables. Expo config maps the canonical values into the mobile build. Create a PR preview dev-client build manually: diff --git a/apps/mobile/app.config.ts b/apps/mobile/app.config.ts index 18aaee0714..7266ff0401 100644 --- a/apps/mobile/app.config.ts +++ b/apps/mobile/app.config.ts @@ -155,7 +155,7 @@ const config: ExpoConfig = { extra: { appVariant: APP_VARIANT, relay: { - url: repoEnv.T3_RELAY_URL ?? null, + url: repoEnv.T3CODE_RELAY_URL ?? null, }, clerk: { publishableKey: repoEnv.EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY ?? null, diff --git a/apps/web/src/cloud/linkEnvironment.test.ts b/apps/web/src/cloud/linkEnvironment.test.ts index 2eccdd113f..fe331ec81d 100644 --- a/apps/web/src/cloud/linkEnvironment.test.ts +++ b/apps/web/src/cloud/linkEnvironment.test.ts @@ -108,7 +108,7 @@ describe("web cloud link environment client", () => { beforeEach(() => { vi.restoreAllMocks(); createProofMock.mockClear(); - vi.stubEnv("VITE_T3_RELAY_URL", "https://relay.example.test"); + vi.stubEnv("VITE_T3CODE_RELAY_URL", "https://relay.example.test"); getSavedEnvironmentSecretMock.mockResolvedValue("local-bearer"); vi.mocked(readPrimaryEnvironmentDescriptor).mockReturnValue(null); vi.mocked(readPrimaryEnvironmentTarget).mockReturnValue(null); diff --git a/apps/web/src/cloud/linkEnvironment.ts b/apps/web/src/cloud/linkEnvironment.ts index ec133b6589..9542b4195e 100644 --- a/apps/web/src/cloud/linkEnvironment.ts +++ b/apps/web/src/cloud/linkEnvironment.ts @@ -285,7 +285,7 @@ export function listManagedCloudEnvironments(input: { const configuredRelayUrl = relayUrl(); if (!configuredRelayUrl) { return yield* new CloudEnvironmentLinkError({ - message: "T3_RELAY_URL is not configured.", + message: "T3CODE_RELAY_URL is not configured.", }); } const relayClient = yield* ManagedRelayClient; @@ -315,7 +315,7 @@ export function listCloudDevices(input: { return Effect.gen(function* () { if (!relayUrl()) { return yield* new CloudEnvironmentLinkError({ - message: "T3_RELAY_URL is not configured.", + message: "T3CODE_RELAY_URL is not configured.", }); } const relayClient = yield* ManagedRelayClient; @@ -344,7 +344,7 @@ export function connectManagedCloudEnvironment(input: { const configuredRelayUrl = relayUrl(); if (!configuredRelayUrl) { return yield* new CloudEnvironmentLinkError({ - message: "T3_RELAY_URL is not configured.", + message: "T3CODE_RELAY_URL is not configured.", }); } const persistedRelayUrl = normalizeRelayBaseUrl(input.relayUrl); @@ -519,7 +519,7 @@ export function linkEnvironmentToCloud(input: { const configuredRelayUrl = relayUrl(); if (!configuredRelayUrl) { return yield* new CloudEnvironmentLinkError({ - message: "T3_RELAY_URL is not configured.", + message: "T3CODE_RELAY_URL is not configured.", }); } const relayClient = yield* ManagedRelayClient; @@ -614,7 +614,7 @@ export function linkPrimaryEnvironmentToCloud(input: { const configuredRelayUrl = relayUrl(); if (!configuredRelayUrl) { return yield* new CloudEnvironmentLinkError({ - message: "T3_RELAY_URL is not configured.", + message: "T3CODE_RELAY_URL is not configured.", }); } const relayClient = yield* ManagedRelayClient; diff --git a/apps/web/src/cloud/publicConfig.test.ts b/apps/web/src/cloud/publicConfig.test.ts index 7ccf90b6a7..c40026ee06 100644 --- a/apps/web/src/cloud/publicConfig.test.ts +++ b/apps/web/src/cloud/publicConfig.test.ts @@ -9,13 +9,13 @@ afterEach(() => { describe("hasCloudPublicConfig", () => { it("requires both public cloud values", () => { vi.stubEnv("VITE_CLERK_PUBLISHABLE_KEY", ""); - vi.stubEnv("VITE_T3_RELAY_URL", ""); + vi.stubEnv("VITE_T3CODE_RELAY_URL", ""); expect(hasCloudPublicConfig()).toBe(false); vi.stubEnv("VITE_CLERK_PUBLISHABLE_KEY", "pk_test_example"); expect(hasCloudPublicConfig()).toBe(false); - vi.stubEnv("VITE_T3_RELAY_URL", "https://relay.example.test"); + vi.stubEnv("VITE_T3CODE_RELAY_URL", "https://relay.example.test"); expect(hasCloudPublicConfig()).toBe(true); }); }); diff --git a/apps/web/src/cloud/publicConfig.ts b/apps/web/src/cloud/publicConfig.ts index bac4deb1ba..1df9696209 100644 --- a/apps/web/src/cloud/publicConfig.ts +++ b/apps/web/src/cloud/publicConfig.ts @@ -13,8 +13,10 @@ export function resolveCloudPublicConfig(): CloudPublicConfig { import.meta.env.VITE_CLERK_PUBLISHABLE_KEY as string | undefined, ), relayUrl: - trimNonEmpty(import.meta.env.VITE_T3_RELAY_URL as string | undefined)?.replace(/\/+$/u, "") ?? - null, + trimNonEmpty(import.meta.env.VITE_T3CODE_RELAY_URL as string | undefined)?.replace( + /\/+$/u, + "", + ) ?? null, }; } diff --git a/apps/web/vite.config.ts b/apps/web/vite.config.ts index 13d4e73a74..381dac5889 100644 --- a/apps/web/vite.config.ts +++ b/apps/web/vite.config.ts @@ -16,7 +16,7 @@ Object.assign(process.env, repoEnv); const port = Number(process.env.PORT ?? 5733); const host = process.env.HOST?.trim() || "localhost"; const configuredWsUrl = process.env.VITE_WS_URL?.trim(); -const configuredRelayUrl = repoEnv.VITE_T3_RELAY_URL?.trim() || ""; +const configuredRelayUrl = repoEnv.VITE_T3CODE_RELAY_URL?.trim() || ""; const configuredClerkPublishableKey = repoEnv.VITE_CLERK_PUBLISHABLE_KEY?.trim() || ""; const configuredHostedAppChannel = process.env.VITE_HOSTED_APP_CHANNEL?.trim() || ""; const configuredAppVersion = process.env.APP_VERSION?.trim() || pkg.version; @@ -130,7 +130,7 @@ export default defineConfig(() => { define: { // In dev mode, tell the web app where the WebSocket server lives "import.meta.env.VITE_WS_URL": JSON.stringify(configuredWsUrl ?? ""), - "import.meta.env.VITE_T3_RELAY_URL": JSON.stringify(configuredRelayUrl), + "import.meta.env.VITE_T3CODE_RELAY_URL": JSON.stringify(configuredRelayUrl), "import.meta.env.VITE_CLERK_PUBLISHABLE_KEY": JSON.stringify(configuredClerkPublishableKey), "import.meta.env.VITE_HOSTED_APP_URL": JSON.stringify(configuredHostedAppUrl ?? ""), "import.meta.env.VITE_HOSTED_APP_CHANNEL": JSON.stringify(configuredHostedAppChannel), diff --git a/docs/release.md b/docs/release.md index 37051aecb1..34cbbef2c4 100644 --- a/docs/release.md +++ b/docs/release.md @@ -56,8 +56,8 @@ Required repository secrets shared by relay deployments: Required `production` environment variables: -- `T3_RELAY_DOMAIN` -- `T3_RELAY_ZONE_NAME` +- `T3CODE_RELAY_DOMAIN` +- `T3CODE_RELAY_ZONE_NAME` - `T3CODE_CLERK_PUBLISHABLE_KEY` - `CLERK_CLI_OAUTH_CLIENT_ID` - `APNS_ENVIRONMENT` diff --git a/docs/t3-cloud-clerk.md b/docs/t3-cloud-clerk.md index 13fa007406..7f07a1460c 100644 --- a/docs/t3-cloud-clerk.md +++ b/docs/t3-cloud-clerk.md @@ -11,11 +11,11 @@ or `.env.local` file: ```dotenv T3CODE_CLERK_PUBLISHABLE_KEY= -T3_RELAY_URL=https://relay.example.com +T3CODE_RELAY_URL=https://relay.example.com ``` The shared client loader projects these canonical values into the framework-specific -`VITE_CLERK_PUBLISHABLE_KEY`, `VITE_T3_RELAY_URL`, and +`VITE_CLERK_PUBLISHABLE_KEY`, `VITE_T3CODE_RELAY_URL`, and `EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY` aliases. Existing aliases remain accepted as overrides for compatibility, but new client configuration should use the canonical names. @@ -28,17 +28,17 @@ Configuration precedence is: The Clerk publishable key and relay URL are public identifiers, not secrets. Web, desktop, and mobile builds statically inject them during their build step. A built artifact does not need an environment file at runtime. CI release builds should set `T3CODE_CLERK_PUBLISHABLE_KEY` and -`T3_RELAY_URL` before building. EAS preview and production builds should define the same +`T3CODE_RELAY_URL` before building. EAS preview and production builds should define the same client-facing values in their EAS environment. When either public value is absent, cloud UI is omitted. For a hosted relay deployment, copy `infra/relay/.env.example` to `infra/relay/.env`. The relay -deployment reads `T3_RELAY_DOMAIN`, `T3_RELAY_ZONE_NAME`, and +deployment reads `T3CODE_RELAY_DOMAIN`, `T3CODE_RELAY_ZONE_NAME`, and `T3CODE_CLERK_PUBLISHABLE_KEY` through Effect `Config`. There are no checked-in deployment defaults. `bun --cwd infra/relay run deploy` invokes Alchemy from the relay directory, so Alchemy loads `infra/relay/.env`. After a successful deployment, the wrapper updates the repository-root `.env` -with the HTTPS relay URL derived from `T3_RELAY_DOMAIN`. The relay still requires +with the HTTPS relay URL derived from `T3CODE_RELAY_DOMAIN`. The relay still requires `CLERK_SECRET_KEY` as an Alchemy secret. Never put `CLERK_SECRET_KEY` in a client application environment or commit it to the repository. @@ -56,7 +56,7 @@ In **Clerk Dashboard > JWT templates**, create a template with: | Claims | `{ "aud": "https://relay.example.com" }` | The `aud` value must be the deployed relay public URL, with no trailing slash. It must match the -client-facing `T3_RELAY_URL` and the HTTPS URL derived from the deployment's `T3_RELAY_DOMAIN`. If +client-facing `T3CODE_RELAY_URL` and the HTTPS URL derived from the deployment's `T3CODE_RELAY_DOMAIN`. If the relay domain changes, update both values and the JWT template. ## Desktop OAuth Redirect Allowlist diff --git a/infra/relay/.env.example b/infra/relay/.env.example index 0e5f015c25..7df5c58f2e 100644 --- a/infra/relay/.env.example +++ b/infra/relay/.env.example @@ -1,11 +1,11 @@ # Required: Relay domain # Use the DNS zone managed in your Cloudflare account. Production deploys use # relay.; personal stages use relay-.. -T3_RELAY_ZONE_NAME=example.com +T3CODE_RELAY_ZONE_NAME=example.com # Optional: Relay domain override # Set this only when the derived relay hostname should not be used. -# T3_RELAY_DOMAIN=relay.example.com +# T3CODE_RELAY_DOMAIN=relay.example.com # Required: Clerk # Get both values from the Clerk Dashboard under API keys. diff --git a/infra/relay/README.md b/infra/relay/README.md index abeec1bc86..8271348928 100644 --- a/infra/relay/README.md +++ b/infra/relay/README.md @@ -100,8 +100,8 @@ bun --cwd infra/relay run deploy -- --env-file .env.local Alchemy defaults personal deployments to the `dev_$USER` stage. Relay custom domains apply the same DNS-safe sanitization as Alchemy physical resource names, so `prod` uses -`relay.` and `dev_julius` uses `relay-dev-julius.`. -`T3_RELAY_DOMAIN` remains available as an explicit override. +`relay.` and `dev_julius` uses `relay-dev-julius.`. +`T3CODE_RELAY_DOMAIN` remains available as an explicit override. After a successful deploy, the wrapper updates the repository-root `.env` file with the derived relay URL. That makes subsequent source builds point at the relay that was just deployed without copying @@ -130,8 +130,8 @@ The repository must define these Actions secrets shared by relay deployments: The `production` GitHub environment must define these Actions variables: -- `T3_RELAY_ZONE_NAME` -- `T3_RELAY_DOMAIN` if overriding the derived production relay domain +- `T3CODE_RELAY_ZONE_NAME` +- `T3CODE_RELAY_DOMAIN` if overriding the derived production relay domain - `T3CODE_CLERK_PUBLISHABLE_KEY` - `APNS_ENVIRONMENT` - `APNS_TEAM_ID` diff --git a/infra/relay/scripts/deploy.test.ts b/infra/relay/scripts/deploy.test.ts index a53c41139c..3adc2468a8 100644 --- a/infra/relay/scripts/deploy.test.ts +++ b/infra/relay/scripts/deploy.test.ts @@ -35,18 +35,18 @@ describe("hasDeployChanges", () => { describe("reconcileRootEnvRelayUrl", () => { it("adds the relay URL to an empty root env file", () => { expect(reconcileRootEnvRelayUrl("", "https://relay.example.test")).toBe( - "T3_RELAY_URL=https://relay.example.test\n", + "T3CODE_RELAY_URL=https://relay.example.test\n", ); }); it("preserves unrelated root env entries while replacing a previous relay URL", () => { expect( reconcileRootEnvRelayUrl( - "T3CODE_CLERK_PUBLISHABLE_KEY=pk_test_example\nT3_RELAY_URL=https://old.example.test\n", + "T3CODE_CLERK_PUBLISHABLE_KEY=pk_test_example\nT3CODE_RELAY_URL=https://old.example.test\n", "https://relay.example.test", ), ).toBe( - "T3CODE_CLERK_PUBLISHABLE_KEY=pk_test_example\nT3_RELAY_URL=https://relay.example.test\n", + "T3CODE_CLERK_PUBLISHABLE_KEY=pk_test_example\nT3CODE_RELAY_URL=https://relay.example.test\n", ); }); }); diff --git a/infra/relay/scripts/deploy.ts b/infra/relay/scripts/deploy.ts index 0948fb4145..8b5f713d9a 100644 --- a/infra/relay/scripts/deploy.ts +++ b/infra/relay/scripts/deploy.ts @@ -42,9 +42,9 @@ export interface RelayDeployOptions { } export function reconcileRootEnvRelayUrl(contents: string, relayUrl: string): string { - const entry = `T3_RELAY_URL=${relayUrl}`; - if (/^T3_RELAY_URL=.*$/mu.test(contents)) { - return contents.replace(/^T3_RELAY_URL=.*$/mu, entry); + const entry = `T3CODE_RELAY_URL=${relayUrl}`; + if (/^T3CODE_RELAY_URL=.*$/mu.test(contents)) { + return contents.replace(/^T3CODE_RELAY_URL=.*$/mu, entry); } if (!contents) { return `${entry}\n`; @@ -94,7 +94,7 @@ const reconcileRootEnv = Effect.fn("relay.deploy.reconcileRootEnv")(function* (r const contents = (yield* fs.exists(rootEnvPath)) ? yield* fs.readFileString(rootEnvPath) : ""; yield* fs.writeFileString(rootEnvPath, reconcileRootEnvRelayUrl(contents, relayUrl)); - yield* Console.log(`Updated ${rootEnvPath} with T3_RELAY_URL=${relayUrl}`); + yield* Console.log(`Updated ${rootEnvPath} with T3CODE_RELAY_URL=${relayUrl}`); }); const deployServices = Layer.mergeAll( diff --git a/infra/relay/src/zone.ts b/infra/relay/src/zone.ts index bd48cea535..f8063622b6 100644 --- a/infra/relay/src/zone.ts +++ b/infra/relay/src/zone.ts @@ -9,8 +9,8 @@ import { relayPublicDomainForStage } from "./deploymentConfig.ts"; export const RelayDeploymentConfig = Effect.gen(function* () { const stage = yield* Alchemy.Stage; - const managedEndpointZoneName = yield* Config.nonEmptyString("T3_RELAY_ZONE_NAME"); - const relayPublicDomainOverride = yield* Config.nonEmptyString("T3_RELAY_DOMAIN").pipe( + const managedEndpointZoneName = yield* Config.nonEmptyString("T3CODE_RELAY_ZONE_NAME"); + const relayPublicDomainOverride = yield* Config.nonEmptyString("T3CODE_RELAY_DOMAIN").pipe( Config.option, ); const relayPublicDomain = Option.getOrElse(relayPublicDomainOverride, () => diff --git a/scripts/lib/public-config.test.ts b/scripts/lib/public-config.test.ts index fea7a7ad3b..f5af24a500 100644 --- a/scripts/lib/public-config.test.ts +++ b/scripts/lib/public-config.test.ts @@ -21,27 +21,29 @@ describe("loadRepoEnv", () => { expect(env.T3CODE_CLERK_PUBLISHABLE_KEY).toBeUndefined(); expect(env.VITE_CLERK_PUBLISHABLE_KEY).toBeUndefined(); expect(env.EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY).toBeUndefined(); - expect(env.T3_RELAY_URL).toBeUndefined(); - expect(env.VITE_T3_RELAY_URL).toBeUndefined(); + expect(env.T3CODE_RELAY_URL).toBeUndefined(); + expect(env.VITE_T3CODE_RELAY_URL).toBeUndefined(); }); it("applies process, root local, and root precedence in that order", () => { const repoRoot = makeTemporaryDirectory(); writeFileSync( join(repoRoot, ".env"), - "T3CODE_CLERK_PUBLISHABLE_KEY=pk_root\nT3_RELAY_URL=https://root.example.test\n", + "T3CODE_CLERK_PUBLISHABLE_KEY=pk_root\nT3CODE_RELAY_URL=https://root.example.test\n", ); writeFileSync( join(repoRoot, ".env.local"), - "T3CODE_CLERK_PUBLISHABLE_KEY=pk_local\nT3_RELAY_URL=https://local.example.test\n", + "T3CODE_CLERK_PUBLISHABLE_KEY=pk_local\nT3CODE_RELAY_URL=https://local.example.test\n", ); - expect(loadRepoEnv({ baseEnv: {}, repoRoot }).T3_RELAY_URL).toBe("https://local.example.test"); + expect(loadRepoEnv({ baseEnv: {}, repoRoot }).T3CODE_RELAY_URL).toBe( + "https://local.example.test", + ); expect( loadRepoEnv({ baseEnv: { T3CODE_CLERK_PUBLISHABLE_KEY: "pk_ci", - T3_RELAY_URL: "https://ci.example.test", + T3CODE_RELAY_URL: "https://ci.example.test", }, repoRoot, }), @@ -49,8 +51,8 @@ describe("loadRepoEnv", () => { T3CODE_CLERK_PUBLISHABLE_KEY: "pk_ci", VITE_CLERK_PUBLISHABLE_KEY: "pk_ci", EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY: "pk_ci", - T3_RELAY_URL: "https://ci.example.test", - VITE_T3_RELAY_URL: "https://ci.example.test", + T3CODE_RELAY_URL: "https://ci.example.test", + VITE_T3CODE_RELAY_URL: "https://ci.example.test", }); }); @@ -58,7 +60,7 @@ describe("loadRepoEnv", () => { expect( resolvePublicConfig({ VITE_CLERK_PUBLISHABLE_KEY: "pk_legacy", - VITE_T3_RELAY_URL: "https://legacy.example.test", + VITE_T3CODE_RELAY_URL: "https://legacy.example.test", }), ).toEqual({ clerkPublishableKey: "pk_legacy", @@ -70,13 +72,13 @@ describe("loadRepoEnv", () => { expect( loadRepoEnv({ baseEnv: { - T3_RELAY_URL: "https://relay.example.test", + T3CODE_RELAY_URL: "https://relay.example.test", }, repoRoot: makeTemporaryDirectory(), }), ).toEqual({ - T3_RELAY_URL: "https://relay.example.test", - VITE_T3_RELAY_URL: "https://relay.example.test", + T3CODE_RELAY_URL: "https://relay.example.test", + VITE_T3CODE_RELAY_URL: "https://relay.example.test", }); }); }); diff --git a/scripts/lib/public-config.ts b/scripts/lib/public-config.ts index 9eb3522128..ea3819bf84 100644 --- a/scripts/lib/public-config.ts +++ b/scripts/lib/public-config.ts @@ -39,8 +39,8 @@ export function loadRepoEnv({ : {}), ...(config.relayUrl ? { - T3_RELAY_URL: config.relayUrl, - VITE_T3_RELAY_URL: config.relayUrl, + T3CODE_RELAY_URL: config.relayUrl, + VITE_T3CODE_RELAY_URL: config.relayUrl, } : {}), }; @@ -54,7 +54,7 @@ export function resolvePublicConfig(...sources: readonly Environment[]): T3CodeP "VITE_CLERK_PUBLISHABLE_KEY", "EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY", ), - relayUrl: firstNonEmpty(sources, "T3_RELAY_URL", "VITE_T3_RELAY_URL"), + relayUrl: firstNonEmpty(sources, "T3CODE_RELAY_URL", "VITE_T3CODE_RELAY_URL"), }; }