d6b16f5e06
Auth BFF (OIDC + prompt=none silent SSO), Mongo data layer, admin CRUD (folders/tags/stories/chapters with TipTap), public reader with tag filtering. Built and verified same-session per design-018-stories.md.
46 lines
1.6 KiB
JavaScript
46 lines
1.6 KiB
JavaScript
'use strict';
|
|
|
|
require('dotenv').config({ path: '/etc/AGWOL/stomping/.env' });
|
|
|
|
const env = {
|
|
NODE_ENV: process.env.NODE_ENV || 'production',
|
|
PORT: parseInt(process.env.PORT || '5003', 10),
|
|
|
|
// Auth — shared platform HS256 secret, must match auth.agwol.com
|
|
ACCESS_TOKEN_SECRET: process.env.ACCESS_TOKEN_SECRET,
|
|
COOKIE_SECRET: process.env.COOKIE_SECRET,
|
|
|
|
// MongoDB — own `stomping` database, per-service pattern
|
|
MONGODB_URI: process.env.MONGODB_URI,
|
|
|
|
// Redis — shared instance (revocation checks, same DB as auth/api/hub/chat)
|
|
REDIS_HOST: process.env.REDIS_HOST || 'localhost',
|
|
REDIS_PORT: parseInt(process.env.REDIS_PORT || '6379', 10),
|
|
REDIS_PASSWORD: process.env.REDIS_PASSWORD || undefined,
|
|
REDIS_DB: parseInt(process.env.REDIS_DB || '0', 10),
|
|
|
|
// CORS
|
|
ALLOWED_ORIGINS: (process.env.ALLOWED_ORIGINS || 'https://stomping.me').split(','),
|
|
|
|
// OIDC — standard client of auth.agwol.com
|
|
AUTH_PUBLIC_ORIGIN: process.env.AUTH_PUBLIC_ORIGIN || 'https://auth.agwol.com',
|
|
AUTH_INTERNAL_URL: process.env.AUTH_INTERNAL_URL || 'http://127.0.0.1:3001',
|
|
OIDC_CLIENT_ID: process.env.OIDC_CLIENT_ID,
|
|
OIDC_CLIENT_SECRET: process.env.OIDC_CLIENT_SECRET,
|
|
OIDC_REDIRECT_URI: process.env.OIDC_REDIRECT_URI,
|
|
OIDC_POST_LOGOUT_URI: process.env.OIDC_POST_LOGOUT_URI,
|
|
};
|
|
|
|
const required = [
|
|
'ACCESS_TOKEN_SECRET', 'COOKIE_SECRET', 'MONGODB_URI',
|
|
'REDIS_PASSWORD', 'OIDC_CLIENT_ID', 'OIDC_CLIENT_SECRET', 'OIDC_REDIRECT_URI',
|
|
];
|
|
for (const key of required) {
|
|
if (!env[key]) {
|
|
console.error(`[ENV] Missing required environment variable: ${key}`);
|
|
process.exit(1);
|
|
}
|
|
}
|
|
|
|
module.exports = { env };
|