Skip to content

Commit

Permalink
remove PROD_URL
Browse files Browse the repository at this point in the history
  • Loading branch information
Brendonovich committed May 17, 2024
1 parent c5856ea commit a185273
Showing 1 changed file with 34 additions and 35 deletions.
69 changes: 34 additions & 35 deletions apps/web/src/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,42 @@ import { createEnv } from "@t3-oss/env-core";
import { z } from "zod";

function optional_in_dev<T extends z.ZodTypeAny>(
schema: T,
schema: T,
): z.ZodOptional<T> | T {
return process.env.NODE_ENV === "development" ? schema.optional() : schema;
return process.env.NODE_ENV === "development" ? schema.optional() : schema;
}

export const env = createEnv({
server: {
// Used to secure the session for the dashboard
AUTH_SECRET: z.string(),
// Used to secure the JWT's used for MDM authentication
// This is shared with Rust so both sides can sign/verify JWT's
//
// This token is also used to authenticate `apps/web` with the Rust code when making HTTP requests
INTERNAL_SECRET: z.string(),
DATABASE_URL: z.string(),
PROD_URL: z.string(),
MDM_URL: z.string(),
FROM_ADDRESS: z.string(),
// Emails and other AWS services
// Get these values from the output of the Cloudformation template
AWS_ACCESS_KEY_ID: optional_in_dev(z.string()),
AWS_SECRET_ACCESS_KEY: optional_in_dev(z.string()),
// Stipe billing
STRIPE_PUBLISHABLE_KEY: z.string(),
STRIPE_SECRET_KEY: z.string(),
// Used for syncing users from Entra to Mattrax
ENTRA_CLIENT_ID: z.string(),
ENTRA_CLIENT_SECRET: z.string(),
NODE_ENV: z.enum(["development", "production"]).default("development"),
FEEDBACK_DISCORD_WEBHOOK_URL: z.string().optional(),
WAITLIST_DISCORD_WEBHOOK_URL: z.string().optional(),
},
clientPrefix: "VITE_",
client: {
VITE_PROD_URL: z.string(),
},
// We need to manually list the env's for the frontend bundle
runtimeEnv: { VITE_PROD_URL: import.meta.env?.VITE_PROD_URL, ...process.env },
emptyStringAsUndefined: true,
server: {
// Used to secure the session for the dashboard
AUTH_SECRET: z.string(),
// Used to secure the JWT's used for MDM authentication
// This is shared with Rust so both sides can sign/verify JWT's
//
// This token is also used to authenticate `apps/web` with the Rust code when making HTTP requests
INTERNAL_SECRET: z.string(),
DATABASE_URL: z.string(),
MDM_URL: z.string(),
FROM_ADDRESS: z.string(),
// Emails and other AWS services
// Get these values from the output of the Cloudformation template
AWS_ACCESS_KEY_ID: optional_in_dev(z.string()),
AWS_SECRET_ACCESS_KEY: optional_in_dev(z.string()),
// Stipe billing
STRIPE_PUBLISHABLE_KEY: z.string(),
STRIPE_SECRET_KEY: z.string(),
// Used for syncing users from Entra to Mattrax
ENTRA_CLIENT_ID: z.string(),
ENTRA_CLIENT_SECRET: z.string(),
NODE_ENV: z.enum(["development", "production"]).default("development"),
FEEDBACK_DISCORD_WEBHOOK_URL: z.string().optional(),
WAITLIST_DISCORD_WEBHOOK_URL: z.string().optional(),
},
clientPrefix: "VITE_",
client: {
VITE_PROD_URL: z.string(),
},
// We need to manually list the env's for the frontend bundle
runtimeEnv: { VITE_PROD_URL: import.meta.env?.VITE_PROD_URL, ...process.env },
emptyStringAsUndefined: true,
});

0 comments on commit a185273

Please sign in to comment.