profileShare

rasmusjy / profileshare

Read-only snapshot

No repository description.

main default branch 54 files Expires Sep 13, 2026, 9:06 AM
config.js 846 bytes
1 export function loadConfig(env = process.env) {
2 const githubConfigured = Boolean(env.GITHUB_CLIENT_ID || env.GITHUB_CLIENT_SECRET || env.GITHUB_APP_SLUG);
3 const weakSecret = !env.SESSION_SECRET
4 || env.SESSION_SECRET.length < 32
5 || env.SESSION_SECRET.startsWith("replace-");
6 if ((env.NODE_ENV === "production" || githubConfigured) && weakSecret) {
7 throw new Error("SESSION_SECRET must contain at least 32 random characters.");
8 }
9 return {
10 port: Number(env.PORT || 3000),
11 baseUrl: env.BASE_URL || "http://localhost:3000",
12 databasePath: env.DATABASE_PATH || "data/profileshare.db",
13 sessionSecret: env.SESSION_SECRET || "development-only-secret",
14 github: {
15 clientId: env.GITHUB_CLIENT_ID || "",
16 clientSecret: env.GITHUB_CLIENT_SECRET || "",
17 appSlug: env.GITHUB_APP_SLUG || "",
18 },
19 };
20 }
21