inital #3
This commit is contained in:
@@ -1,36 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.DefaultConfig = void 0;
|
||||
const env = require("env-var");
|
||||
const _1 = require(".");
|
||||
const NODE_ENV = env.get('NODE_ENV').default("development").asString();
|
||||
const isProduction = NODE_ENV === 'production';
|
||||
const envs = {
|
||||
NODE_ENV,
|
||||
// port of the server
|
||||
PORT: env.get('PORT').default('3000').asPortNumber(),
|
||||
// hostname of the server ('0.0.0.0' listens on all network interfaces)
|
||||
HOSTNAME: env.get('HOSTNAME').default('0.0.0.0').asString(),
|
||||
// base path
|
||||
BASE_PATH: env.get('BASE_PATH').default('/').asString(),
|
||||
// external base url
|
||||
EXTERNAL_BASE_URL: env.get('EXTERNAL_BASE_URL').asString(),
|
||||
// url of redis session store (required in production using InMemory)
|
||||
REDIS_URL: env.get('REDIS_URL').asString() || undefined,
|
||||
// cookie secret for the session id (required in production using Session)
|
||||
SESSION_SECRET: env.get('SESSION_SECRET').asString() || undefined,
|
||||
// header where user info token is stored to request auth proxy
|
||||
USERINFO_HEADER: env.get('USERINFO_HEADER').asString() || undefined,
|
||||
// base url to init a logout or request user info
|
||||
AUTH_PROXY_URL: env.get('AUTH_PROXY_URL').asString() || undefined,
|
||||
// override base url to request user info
|
||||
AUTH_PROXY_USERINFO_URL: env.get('AUTH_PROXY_USERINFO_URL').asString() || undefined,
|
||||
// override base url to init a logout
|
||||
AUTH_PROXY_INIT_LOGOUT_URL: env.get('AUTH_PROXY_INIT_LOGOUT_URL').asString() || undefined,
|
||||
};
|
||||
function requireEnv(name, onlyInProduction = false) {
|
||||
env.get(name).required(!onlyInProduction || isProduction).asString();
|
||||
}
|
||||
exports.DefaultConfig = Object.assign(Object.assign({}, envs), { EXTERNAL_BASE_URL: envs.EXTERNAL_BASE_URL ||
|
||||
_1.urlJoin(`http://${envs.HOSTNAME}${envs.PORT !== 80 ? `:${envs.PORT}` : ""}`, envs.BASE_PATH), isProduction,
|
||||
requireEnv });
|
||||
Reference in New Issue
Block a user