28 lines
1.1 KiB
TypeScript
28 lines
1.1 KiB
TypeScript
import 'dotenv/config';
|
|
import path from 'node:path';
|
|
|
|
export const config = {
|
|
port: parseInt(process.env.PORT || '9002', 10),
|
|
nodeEnv: process.env.NODE_ENV || 'development',
|
|
databaseUrl: process.env.DATABASE_URL || 'postgresql://fitos:fitos@localhost:5432/fitos',
|
|
jwt: {
|
|
accessSecret: process.env.JWT_ACCESS_SECRET || 'dev-access-secret',
|
|
refreshSecret: process.env.JWT_REFRESH_SECRET || 'dev-refresh-secret',
|
|
accessTtlSec: 15 * 60,
|
|
refreshTtlSec: 7 * 24 * 3600,
|
|
},
|
|
firstAdminEmail: process.env.FITOS_FIRST_ADMIN_EMAIL,
|
|
firstAdminPassword: process.env.FITOS_FIRST_ADMIN_PASSWORD || 'ChangeMe123!',
|
|
logLevel: process.env.LOG_LEVEL || 'info',
|
|
uploadDir: process.env.UPLOAD_DIR || path.join(process.cwd(), 'uploads'),
|
|
// true only when served over HTTPS — over plain HTTP browsers drop Secure cookies (breaks refresh)
|
|
cookieSecure: process.env.COOKIE_SECURE === 'true',
|
|
corsOriginPatterns: [
|
|
/^https?:\/\/(www\.)?domena\.pl(:\d+)?$/,
|
|
/^https?:\/\/admin\.domena\.pl(:\d+)?$/,
|
|
/^https?:\/\/(www\.)?tisachi\.ddns\.net(:\d+)?$/,
|
|
/^https?:\/\/localhost(:\d+)?$/,
|
|
/^https?:\/\/127\.0\.0\.1(:\d+)?$/,
|
|
],
|
|
};
|