Files
Homelab-manager/server/src/env.ts
T
bobbanandClaude Sonnet 5 3255314402 Build the Settings module: notification channels, event toggles, DNS badge colors
The Settings page was a "coming soon" placeholder. Port Sloth Manager's
settings feature set: Gotify/ntfy/SMTP/webhook notification channels
(each with its own test-send button), per-event toggles (DNS record
added/updated/deleted, a daily secret-expiry digest with configurable
time/timezone), and per-provider DNS badge color customization.

Settings persist in the existing `settings` key/value table via a new
settingsStore service; a notify service fans a message out to every
enabled channel. DNS record add/update/delete now fire notifications,
and a node-schedule job re-arms itself whenever the notification
settings change. Removed the now-superseded GOTIFY_URL/GOTIFY_TOKEN
env vars in favor of in-app configuration.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-15 12:14:05 +02:00

36 lines
1.4 KiB
TypeScript

export const env = {
port: Number(process.env.PORT ?? 3000),
nodeEnv: process.env.NODE_ENV ?? "development",
appBaseUrl: process.env.APP_BASE_URL ?? "http://localhost:3000",
sessionSecret: process.env.SESSION_SECRET ?? "dev-insecure-session-secret-change-me",
sessionDir: process.env.SESSION_DIR ?? "../data/sessions",
databasePath: process.env.DATABASE_PATH ?? "../data/homelab-manager.sqlite",
credentialsEncryptionKey: process.env.CREDENTIALS_ENCRYPTION_KEY ?? "",
authentik: {
issuerUrl: process.env.AUTHENTIK_ISSUER_URL ?? "",
clientId: process.env.AUTHENTIK_CLIENT_ID ?? "",
clientSecret: process.env.AUTHENTIK_CLIENT_SECRET ?? "",
},
get authEnabled() {
return Boolean(this.authentik.issuerUrl && this.authentik.clientId && this.authentik.clientSecret);
},
get credentialsEncryptionEnabled() {
return this.credentialsEncryptionKey.length === 64;
},
};
export function warnIfAuthNotConfigured() {
if (!env.authEnabled) {
console.warn(
"AUTHENTIK_ISSUER_URL / AUTHENTIK_CLIENT_ID / AUTHENTIK_CLIENT_SECRET are not fully set. " +
"The app will boot, but /auth/login and /auth/logout will fail until they are configured.",
);
}
if (!env.credentialsEncryptionEnabled) {
console.warn(
"CREDENTIALS_ENCRYPTION_KEY is not set to a 64-character hex string. " +
"Saving integration credentials (Proxmox/Synology/etc API tokens) will fail until it is configured.",
);
}
}