"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BaseAppConfig = void 0;
exports.isDevFeatureEnabled = isDevFeatureEnabled;
const tslib_1 = require("tslib");
const _a = tslib_1.__importStar(require("@zyno-io/ts-server-foundation/type-metadata-runtime"));
const availability_1 = require("../helpers/availability");
const const_1 = require("./const");
const __tsf_metadata_type = _a.createCompactMetadataRegistryV1("[1,[{\"kind\":6},{\"kind\":8},{\"kind\":7},{\"kind\":12,\"types\":[{\"kind\":10,\"literal\":\"mysql\"},{\"kind\":10,\"literal\":\"postgres\"}]},{\"kind\":12,\"types\":[{\"kind\":10,\"literal\":\"local\"},{\"kind\":10,\"literal\":\"redis\"}]},{\"kind\":2},{\"kind\":12,\"types\":[{\"kind\":10,\"literal\":\"none\"},{\"kind\":10,\"literal\":\"e2e\"},{\"kind\":10,\"literal\":\"finish\"},{\"kind\":10,\"literal\":\"errors\"}]},{\"kind\":12,\"types\":[{\"kind\":10,\"literal\":\"smtp\"},{\"kind\":10,\"literal\":\"postmark\"}]}]]", []);
let _BaseAppConfigMetadata_1;
class BaseAppConfig {
    APP_ENV;
    DEVCONSOLE_ENABLED;
    PORT;
    DB_ADAPTER;
    MYSQL_HOST;
    MYSQL_PORT;
    MYSQL_USER;
    MYSQL_PASSWORD_SECRET;
    MYSQL_DATABASE;
    MYSQL_CONNECTION_LIMIT;
    MYSQL_MIN_IDLE_CONNECTIONS;
    MYSQL_IDLE_TIMEOUT_SECONDS;
    PG_HOST;
    PG_PORT;
    PG_USER;
    PG_PASSWORD_SECRET;
    PG_DATABASE;
    PG_SCHEMA;
    PG_SSL;
    PG_SSL_REJECT_UNAUTHORIZED;
    PG_CONNECTION_LIMIT;
    PG_IDLE_TIMEOUT_SECONDS;
    AUTH_JWT_ISSUER;
    AUTH_JWT_EXPIRATION_MINS;
    AUTH_JWT_COOKIE_NAME;
    AUTH_JWT_SECRET;
    AUTH_JWT_SECRET_B64;
    AUTH_JWT_ED_SECRET;
    AUTH_JWT_ENABLE_VERIFY = true;
    AUTH_BASIC_SECRET;
    CRYPTO_SECRET;
    CRYPTO_IV_LENGTH = 12;
    USE_REAL_IP_HEADER;
    REDIS_SENTINEL_HOST;
    REDIS_SENTINEL_PORT;
    REDIS_SENTINEL_NAME;
    REDIS_HOST;
    REDIS_PORT;
    REDIS_PREFIX;
    REDIS_UNAVAILABLE_ALERT_AFTER_MS = availability_1.DEFAULT_AVAILABILITY_ALERT_AFTER_MS;
    CACHE_REDIS_SENTINEL_HOST;
    CACHE_REDIS_SENTINEL_PORT;
    CACHE_REDIS_SENTINEL_NAME;
    CACHE_REDIS_HOST;
    CACHE_REDIS_PORT;
    CACHE_REDIS_PREFIX;
    MUTEX_REDIS_SENTINEL_HOST;
    MUTEX_REDIS_SENTINEL_PORT;
    MUTEX_REDIS_SENTINEL_NAME;
    MUTEX_REDIS_HOST;
    MUTEX_REDIS_PORT;
    MUTEX_REDIS_PREFIX;
    BROADCAST_REDIS_SENTINEL_HOST;
    BROADCAST_REDIS_SENTINEL_PORT;
    BROADCAST_REDIS_SENTINEL_NAME;
    BROADCAST_REDIS_HOST;
    BROADCAST_REDIS_PORT;
    BROADCAST_REDIS_PREFIX;
    MESH_REDIS_SENTINEL_HOST;
    MESH_REDIS_SENTINEL_PORT;
    MESH_REDIS_SENTINEL_NAME;
    MESH_REDIS_HOST;
    MESH_REDIS_PORT;
    MESH_REDIS_PREFIX;
    BULL_REDIS_SENTINEL_HOST;
    BULL_REDIS_SENTINEL_PORT;
    BULL_REDIS_SENTINEL_NAME;
    BULL_REDIS_HOST;
    BULL_REDIS_PORT;
    BULL_REDIS_PREFIX;
    BULL_QUEUE = 'default';
    MUTEX_MODE = 'local';
    ENABLE_OPENAPI_SCHEMA;
    ENABLE_OPENAPI_ROUTE;
    ENABLE_JOB_RUNNER;
    SENTRY_DSN;
    OTEL_EXPORTER_OTLP_ENDPOINT;
    ALERTS_SLACK_WEBHOOK_URL;
    SRPC_AUTH_SECRET;
    SRPC_AUTH_CLOCK_DRIFT_MS = 30000;
    HTTP_REQUEST_LOGGING_MODE = (0, const_1.isTestEnvironment)() ? 'errors' : 'e2e';
    HEALTHZ_ENABLE_REQUEST_LOGGING = false;
    HTTP_MAX_REQUEST_BODY_BYTES = 100 * 1024 * 1024;
    HTTP_MAX_REQUEST_COMPRESSED_BODY_BYTES = 25 * 1024 * 1024;
    MAIL_FROM;
    MAIL_FROM_NAME;
    MAIL_PROVIDER = 'smtp';
    SMTP_HOST = '127.0.0.1';
    SMTP_PORT = 1025;
    SMTP_USER;
    SMTP_PASSWORD_SECRET;
    SMTP_TLS = false;
    POSTMARK_SECRET;
    static __tsfType = _BaseAppConfigMetadata_1 = _a.decodeCompactMetadataV1("[1,{\"kind\":16,\"name\":\"BaseAppConfig\",\"typeName\":\"BaseAppConfig\",\"classType\":{\"$tsf\":0},\"properties\":[{\"name\":\"APP_ENV\",\"type\":{\"$tsfType\":0},\"optional\":false},{\"name\":\"DEVCONSOLE_ENABLED\",\"type\":{\"$tsfType\":1},\"optional\":true},{\"name\":\"PORT\",\"type\":{\"$tsfType\":2},\"optional\":true},{\"name\":\"DB_ADAPTER\",\"type\":{\"$tsfType\":3},\"optional\":true},{\"name\":\"MYSQL_HOST\",\"type\":{\"$tsfType\":0},\"optional\":true},{\"name\":\"MYSQL_PORT\",\"type\":{\"$tsfType\":2},\"optional\":true},{\"name\":\"MYSQL_USER\",\"type\":{\"$tsfType\":0},\"optional\":true},{\"name\":\"MYSQL_PASSWORD_SECRET\",\"type\":{\"$tsfType\":0},\"optional\":true},{\"name\":\"MYSQL_DATABASE\",\"type\":{\"$tsfType\":0},\"optional\":true},{\"name\":\"MYSQL_CONNECTION_LIMIT\",\"type\":{\"$tsfType\":2},\"optional\":true},{\"name\":\"MYSQL_MIN_IDLE_CONNECTIONS\",\"type\":{\"$tsfType\":2},\"optional\":true},{\"name\":\"MYSQL_IDLE_TIMEOUT_SECONDS\",\"type\":{\"$tsfType\":2},\"optional\":true},{\"name\":\"PG_HOST\",\"type\":{\"$tsfType\":0},\"optional\":true},{\"name\":\"PG_PORT\",\"type\":{\"$tsfType\":2},\"optional\":true},{\"name\":\"PG_USER\",\"type\":{\"$tsfType\":0},\"optional\":true},{\"name\":\"PG_PASSWORD_SECRET\",\"type\":{\"$tsfType\":0},\"optional\":true},{\"name\":\"PG_DATABASE\",\"type\":{\"$tsfType\":0},\"optional\":true},{\"name\":\"PG_SCHEMA\",\"type\":{\"$tsfType\":0},\"optional\":true},{\"name\":\"PG_SSL\",\"type\":{\"$tsfType\":1},\"optional\":true},{\"name\":\"PG_SSL_REJECT_UNAUTHORIZED\",\"type\":{\"$tsfType\":1},\"optional\":true},{\"name\":\"PG_CONNECTION_LIMIT\",\"type\":{\"$tsfType\":2},\"optional\":true},{\"name\":\"PG_IDLE_TIMEOUT_SECONDS\",\"type\":{\"$tsfType\":2},\"optional\":true},{\"name\":\"AUTH_JWT_ISSUER\",\"type\":{\"$tsfType\":0},\"optional\":true},{\"name\":\"AUTH_JWT_EXPIRATION_MINS\",\"type\":{\"$tsfType\":2},\"optional\":true},{\"name\":\"AUTH_JWT_COOKIE_NAME\",\"type\":{\"$tsfType\":0},\"optional\":true},{\"name\":\"AUTH_JWT_SECRET\",\"type\":{\"$tsfType\":0},\"optional\":true},{\"name\":\"AUTH_JWT_SECRET_B64\",\"type\":{\"$tsfType\":0},\"optional\":true},{\"name\":\"AUTH_JWT_ED_SECRET\",\"type\":{\"$tsfType\":0},\"optional\":true},{\"name\":\"AUTH_JWT_ENABLE_VERIFY\",\"type\":{\"$tsfType\":1},\"optional\":false},{\"name\":\"AUTH_BASIC_SECRET\",\"type\":{\"$tsfType\":0},\"optional\":true},{\"name\":\"CRYPTO_SECRET\",\"type\":{\"$tsfType\":0},\"optional\":true},{\"name\":\"CRYPTO_IV_LENGTH\",\"type\":{\"$tsfType\":2},\"optional\":false},{\"name\":\"USE_REAL_IP_HEADER\",\"type\":{\"$tsfType\":1},\"optional\":true},{\"name\":\"REDIS_SENTINEL_HOST\",\"type\":{\"$tsfType\":0},\"optional\":true},{\"name\":\"REDIS_SENTINEL_PORT\",\"type\":{\"$tsfType\":2},\"optional\":true},{\"name\":\"REDIS_SENTINEL_NAME\",\"type\":{\"$tsfType\":0},\"optional\":true},{\"name\":\"REDIS_HOST\",\"type\":{\"$tsfType\":0},\"optional\":true},{\"name\":\"REDIS_PORT\",\"type\":{\"$tsfType\":2},\"optional\":true},{\"name\":\"REDIS_PREFIX\",\"type\":{\"$tsfType\":0},\"optional\":true},{\"name\":\"REDIS_UNAVAILABLE_ALERT_AFTER_MS\",\"type\":{\"$tsfType\":2},\"optional\":false},{\"name\":\"CACHE_REDIS_SENTINEL_HOST\",\"type\":{\"$tsfType\":0},\"optional\":true},{\"name\":\"CACHE_REDIS_SENTINEL_PORT\",\"type\":{\"$tsfType\":2},\"optional\":true},{\"name\":\"CACHE_REDIS_SENTINEL_NAME\",\"type\":{\"$tsfType\":0},\"optional\":true},{\"name\":\"CACHE_REDIS_HOST\",\"type\":{\"$tsfType\":0},\"optional\":true},{\"name\":\"CACHE_REDIS_PORT\",\"type\":{\"$tsfType\":2},\"optional\":true},{\"name\":\"CACHE_REDIS_PREFIX\",\"type\":{\"$tsfType\":0},\"optional\":true},{\"name\":\"MUTEX_REDIS_SENTINEL_HOST\",\"type\":{\"$tsfType\":0},\"optional\":true},{\"name\":\"MUTEX_REDIS_SENTINEL_PORT\",\"type\":{\"$tsfType\":2},\"optional\":true},{\"name\":\"MUTEX_REDIS_SENTINEL_NAME\",\"type\":{\"$tsfType\":0},\"optional\":true},{\"name\":\"MUTEX_REDIS_HOST\",\"type\":{\"$tsfType\":0},\"optional\":true},{\"name\":\"MUTEX_REDIS_PORT\",\"type\":{\"$tsfType\":2},\"optional\":true},{\"name\":\"MUTEX_REDIS_PREFIX\",\"type\":{\"$tsfType\":0},\"optional\":true},{\"name\":\"BROADCAST_REDIS_SENTINEL_HOST\",\"type\":{\"$tsfType\":0},\"optional\":true},{\"name\":\"BROADCAST_REDIS_SENTINEL_PORT\",\"type\":{\"$tsfType\":2},\"optional\":true},{\"name\":\"BROADCAST_REDIS_SENTINEL_NAME\",\"type\":{\"$tsfType\":0},\"optional\":true},{\"name\":\"BROADCAST_REDIS_HOST\",\"type\":{\"$tsfType\":0},\"optional\":true},{\"name\":\"BROADCAST_REDIS_PORT\",\"type\":{\"$tsfType\":2},\"optional\":true},{\"name\":\"BROADCAST_REDIS_PREFIX\",\"type\":{\"$tsfType\":0},\"optional\":true},{\"name\":\"MESH_REDIS_SENTINEL_HOST\",\"type\":{\"$tsfType\":0},\"optional\":true},{\"name\":\"MESH_REDIS_SENTINEL_PORT\",\"type\":{\"$tsfType\":2},\"optional\":true},{\"name\":\"MESH_REDIS_SENTINEL_NAME\",\"type\":{\"$tsfType\":0},\"optional\":true},{\"name\":\"MESH_REDIS_HOST\",\"type\":{\"$tsfType\":0},\"optional\":true},{\"name\":\"MESH_REDIS_PORT\",\"type\":{\"$tsfType\":2},\"optional\":true},{\"name\":\"MESH_REDIS_PREFIX\",\"type\":{\"$tsfType\":0},\"optional\":true},{\"name\":\"BULL_REDIS_SENTINEL_HOST\",\"type\":{\"$tsfType\":0},\"optional\":true},{\"name\":\"BULL_REDIS_SENTINEL_PORT\",\"type\":{\"$tsfType\":2},\"optional\":true},{\"name\":\"BULL_REDIS_SENTINEL_NAME\",\"type\":{\"$tsfType\":0},\"optional\":true},{\"name\":\"BULL_REDIS_HOST\",\"type\":{\"$tsfType\":0},\"optional\":true},{\"name\":\"BULL_REDIS_PORT\",\"type\":{\"$tsfType\":2},\"optional\":true},{\"name\":\"BULL_REDIS_PREFIX\",\"type\":{\"$tsfType\":0},\"optional\":true},{\"name\":\"BULL_QUEUE\",\"type\":{\"$tsfType\":0},\"optional\":false},{\"name\":\"MUTEX_MODE\",\"type\":{\"$tsfType\":4},\"optional\":false},{\"name\":\"ENABLE_OPENAPI_SCHEMA\",\"type\":{\"$tsfType\":1},\"optional\":true},{\"name\":\"ENABLE_OPENAPI_ROUTE\",\"type\":{\"$tsfType\":1},\"optional\":true},{\"name\":\"ENABLE_JOB_RUNNER\",\"type\":{\"$tsfType\":1},\"optional\":true},{\"name\":\"SENTRY_DSN\",\"type\":{\"$tsfType\":0},\"optional\":true},{\"name\":\"OTEL_EXPORTER_OTLP_ENDPOINT\",\"type\":{\"$tsfType\":0},\"optional\":true},{\"name\":\"ALERTS_SLACK_WEBHOOK_URL\",\"type\":{\"$tsfType\":0},\"optional\":true},{\"name\":\"SRPC_AUTH_SECRET\",\"type\":{\"$tsfType\":0},\"optional\":true},{\"name\":\"SRPC_AUTH_CLOCK_DRIFT_MS\",\"type\":{\"$tsfType\":5},\"optional\":false},{\"name\":\"HTTP_REQUEST_LOGGING_MODE\",\"type\":{\"$tsfType\":6},\"optional\":false},{\"name\":\"HEALTHZ_ENABLE_REQUEST_LOGGING\",\"type\":{\"$tsfType\":1},\"optional\":false},{\"name\":\"HTTP_MAX_REQUEST_BODY_BYTES\",\"type\":{\"$tsfType\":2},\"optional\":false},{\"name\":\"HTTP_MAX_REQUEST_COMPRESSED_BODY_BYTES\",\"type\":{\"$tsfType\":2},\"optional\":false},{\"name\":\"MAIL_FROM\",\"type\":{\"$tsfType\":0},\"optional\":true},{\"name\":\"MAIL_FROM_NAME\",\"type\":{\"$tsfType\":0},\"optional\":true},{\"name\":\"MAIL_PROVIDER\",\"type\":{\"$tsfType\":7},\"optional\":false},{\"name\":\"SMTP_HOST\",\"type\":{\"$tsfType\":0},\"optional\":false},{\"name\":\"SMTP_PORT\",\"type\":{\"$tsfType\":2},\"optional\":false},{\"name\":\"SMTP_USER\",\"type\":{\"$tsfType\":0},\"optional\":true},{\"name\":\"SMTP_PASSWORD_SECRET\",\"type\":{\"$tsfType\":0},\"optional\":true},{\"name\":\"SMTP_TLS\",\"type\":{\"$tsfType\":1},\"optional\":false},{\"name\":\"POSTMARK_SECRET\",\"type\":{\"$tsfType\":0},\"optional\":true}],\"methods\":[],\"hasConstructor\":false,\"constructorParameters\":[]}]", [() => BaseAppConfig], __tsf_metadata_type);
}
exports.BaseAppConfig = BaseAppConfig;
_BaseAppConfigMetadata_1.classType = BaseAppConfig;
BaseAppConfig.__tsfType = _BaseAppConfigMetadata_1;
function isDevFeatureEnabled(envVar, defaultInDev = true) {
    if (typeof envVar === 'boolean')
        return envVar;
    if (envVar === '0' || envVar === 'false')
        return false;
    if (envVar === '1' || envVar === 'true')
        return true;
    return (0, const_1.isDevelopmentEnvironment)() || (0, const_1.isTestEnvironment)() ? defaultInDev : false;
}
//# sourceMappingURL=config.js.map