"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const config_1 = require("@nestjs/config");
function parseOrigins(value, fallback) {
    const raw = value?.trim() || fallback;
    return raw.split(',').map((o) => o.trim()).filter(Boolean);
}
exports.default = (0, config_1.registerAs)('app', () => ({
    nodeEnv: process.env.NODE_ENV ?? 'development',
    port: parseInt(process.env.PORT ?? '3001', 10),
    apiPrefix: process.env.API_PREFIX ?? 'api',
    appOrigin: process.env.APP_ORIGIN ?? process.env.CORS_ORIGIN ?? 'http://localhost:5173',
    corsOrigins: parseOrigins(process.env.CORS_ORIGINS ?? process.env.CORS_ORIGIN, 'http://localhost:5173,http://localhost:5174'),
    platformAdminEmail: (process.env.PLATFORM_ADMIN_EMAIL ?? '').toLowerCase(),
    uploadPublicUrl: process.env.UPLOAD_PUBLIC_URL ?? '',
    throttleTtl: parseInt(process.env.THROTTLE_TTL ?? '60', 10),
    throttleLimit: parseInt(process.env.THROTTLE_LIMIT ?? '100', 10),
    bcryptRounds: parseInt(process.env.BCRYPT_ROUNDS ?? '12', 10),
    cookieSecret: process.env.COOKIE_SECRET ?? 'cookie-secret',
}));
//# sourceMappingURL=app.config.js.map