forked from mozilla/blurts-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp-constants.js
40 lines (34 loc) · 862 Bytes
/
app-constants.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
"use strict";
/* eslint-disable no-process-env */
const path = require("path");
require("dotenv").load({path: path.join(__dirname, ".env")});
const kEnvironmentVariables = [
"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",
"HIBP_STAGE_API_ROOT",
"HIBP_STAGE_API_TOKEN",
"HIBP_STUB_API_ROOT",
"HIBP_API_ROOT",
"HIBP_API_TOKEN",
"AWS_ACCESS_KEY_ID",
"AWS_SECRET_ACCESS_KEY",
"DATABASE_URL",
];
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];
}
module.exports = Object.freeze(AppConstants);