i currently have auth set up with better auth and working just fine locally, but am having problems in prod, specifically with the lib/auth.ts file
const createOptions = (ctx: GenericCtx) =>
({
baseURL: "http://localhost:3000",
trustedOrigins: [
"http://localhost:3000",
],
...
i currently have it set up like this which works just fine locally, but in prod i'd have to use an environment variable to set the base url/trusted origins
so i use something like process.env.NEXT_PUBLIC_THIS_SITE_URL, and this is where i get a bit confused
it seems like i cannot set this environment locally at all, and i'd have to set this inside the convex dashboard? i think this is because auth.ts is being imported into convex/http.ts so they cannot be set locally using .env files?
so i was just wondering how do i set that variable dynamically based on whether im working locally vs in prod
i did try something like
const thisSiteUrl =
process.env.NODE_ENV === "development"
? "http://localhost:3000"
: process.env.NEXT_PUBLIC_THIS_SITE_URL;
const createOptions = (ctx: GenericCtx) =>
({
baseURL: thisSiteUrl,
but it doesn't work because NODE_ENV will always be prod because it picks up the environment of the cloud-hosted convex instance?
so as of now, i have to either set baseURL/trustedOrigins to either my localhost or either my prod URL for it to work
thanks in advance!