blurts-server/app-constants.js

40 строки
826 B
JavaScript
Исходник Обычный вид История

2018-02-07 22:16:39 +03:00
"use strict";
/* eslint-disable no-process-env */
const path = require("path");
require("dotenv").load({path: path.join(__dirname, ".env")});
2018-02-07 22:16:39 +03:00
const kEnvironmentVariables = [
"NODE_ENV",
2018-02-07 22:16:39 +03:00
"SERVER_URL",
"PORT",
"COOKIE_SECRET",
"SMTP_HOST",
"SMTP_PORT",
"SMTP_USERNAME",
"SMTP_PASSWORD",
"OAUTH_AUTHORIZATION_URI",
"OAUTH_TOKEN_URI",
"OAUTH_PROFILE_URI",
"OAUTH_CLIENT_ID",
"OAUTH_CLIENT_SECRET",
2018-05-22 21:34:41 +03:00
"HIBP_STAGE_API_ROOT",
"HIBP_STAGE_API_TOKEN",
2018-05-15 22:33:22 +03:00
"HIBP_STUB_API_ROOT",
2018-02-06 01:06:05 +03:00
"HIBP_API_ROOT",
"HIBP_API_TOKEN",
2018-03-08 19:26:43 +03:00
"DATABASE_URL",
2018-02-07 22:16:39 +03:00
];
const AppConstants = { };
for (const v of kEnvironmentVariables) {
if (process.env[v] === undefined) {
throw new Error(`Required environment variable was not set: ${v}`);
}
AppConstants[v] = process.env[v];
}
2018-02-07 22:16:39 +03:00
2018-03-03 04:49:32 +03:00
module.exports = Object.freeze(AppConstants);