Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions packages/stacks-docs/src/lib/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,19 @@ import { sveltekitCookies } from "better-auth/svelte-kit";
import { env } from "$env/dynamic/private";
import { getRequestEvent } from "$app/server";

// TODO: Make dynamic once we figure out Netlify env vars at runtime
const baseURL = "https://stackoverflow.design";
// baseURL is set per deploy from Netlify's build-time env vars
// DEPLOY_PRIME_URL tracks the current deploy context
// Static url is the production fallback
const baseURL = env.DEPLOY_PRIME_URL || env.URL || "https://stackoverflow.design";

export const auth = betterAuth({
baseURL,

trustedOrigins: [baseURL, "https://*.stackoverflow.design"],
trustedOrigins: [
"https://stackoverflow.design",
"https://*.stackoverflow.design",
"https://*.private-preview.stackoverflow.design",
],

// Secret for signing cookies and tokens
// openssl rand -base64 32
Expand Down
Loading