- Add docker-compose.prod.yml and Caddyfile for Caddy reverse proxy - Add production stages to frontend Dockerfile (nginx for static files) - Fix monorepo package exports for production builds (dist/src paths) - Add CORS_ORIGIN env var for cross-origin config - Add Better Auth baseURL, cookie domain, and trusted origins from env - Use VITE_API_URL for API calls in auth-client and play route - Add credentials: include for cross-origin fetch requests - Remove unused users table from schema
30 lines
1,003 B
TypeScript
30 lines
1,003 B
TypeScript
import { betterAuth } from "better-auth";
|
|
import { drizzleAdapter } from "better-auth/adapters/drizzle";
|
|
import { db } from "@lila/db";
|
|
import * as schema from "@lila/db/schema";
|
|
|
|
export const auth = betterAuth({
|
|
baseURL: process.env["BETTER_AUTH_URL"] || "http://localhost:3000",
|
|
advanced: {
|
|
cookiePrefix: "lila",
|
|
defaultCookieAttributes: {
|
|
...(process.env["COOKIE_DOMAIN"] && {
|
|
domain: process.env["COOKIE_DOMAIN"],
|
|
}),
|
|
secure: !!process.env["COOKIE_DOMAIN"],
|
|
sameSite: "lax" as const,
|
|
},
|
|
},
|
|
database: drizzleAdapter(db, { provider: "pg", schema }),
|
|
trustedOrigins: [process.env["CORS_ORIGIN"] || "http://localhost:5173"],
|
|
socialProviders: {
|
|
google: {
|
|
clientId: process.env["GOOGLE_CLIENT_ID"] as string,
|
|
clientSecret: process.env["GOOGLE_CLIENT_SECRET"] as string,
|
|
},
|
|
github: {
|
|
clientId: process.env["GITHUB_CLIENT_ID"] as string,
|
|
clientSecret: process.env["GITHUB_CLIENT_SECRET"] as string,
|
|
},
|
|
},
|
|
});
|