-
Notifications
You must be signed in to change notification settings - Fork 21
/
environment.js
78 lines (63 loc) · 2.36 KB
/
environment.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/**
* Environment variables. Please keep declaration in this file in sync with:
* /render.yaml
*/
require('dotenv').config();
const { join, resolve } = require('path');
const VERBOSE = Boolean(process.env.VERBOSE);
const { POSTGRES_URL } = process.env;
const DATA_DIR = resolve(process.env.DATA_DIR);
const UPLOAD_DIR = join(DATA_DIR, 'uploads');
// FIXME: TEMP_DIR should probbaly be a sub-path of uploads.
// see also: https://usdigitalresponse.slack.com/archives/C031R1Y49KL/p1675828761404989
// After we move to AWS, consider uncommenting the following line:
// const TEMP_DIR = join(DATA_DIR, 'tmp')
const TEMP_DIR = join(UPLOAD_DIR, 'tmp');
const PERIOD_TEMPLATES_DIR = join(UPLOAD_DIR, 'period_templates');
// Note: in legacy standalone ARPA Report repo, this points to src/server; in GOST
// it points to packages/server/src/arpa_reporter
const SERVER_CODE_DIR = __dirname;
const SERVER_DATA_DIR = join(SERVER_CODE_DIR, 'data');
const EMPTY_TEMPLATE_NAME = 'ARPA SFRF Reporting Workbook v20240823.xlsm';
const { COOKIE_SECRET } = process.env;
const { NODE_ENV } = process.env;
const IS_DEV = NODE_ENV === 'development';
const LOGIN_EXPIRY_MINUTES = Number.parseInt(process.env.LOGIN_EXPIRY_MINUTES, 10) || 30;
const PORT = Number.parseInt(process.env.PORT, 10) || 3000;
const { WEBSITE_DOMAIN } = process.env;
const ARPA_REPORTER_BASE_URL = `${WEBSITE_DOMAIN}/arpa_reporter`;
const { NOTIFICATIONS_EMAIL } = process.env;
const { NOTIFICATIONS_EMAIL_PW } = process.env;
const { NODEMAILER_HOST } = process.env;
const { NODEMAILER_PORT } = process.env;
const { AWS_ACCESS_KEY_ID } = process.env;
const { AWS_SECRET_ACCESS_KEY } = process.env;
const { LOGIN_DISABLED_MESSAGE } = process.env;
const { LOGIN_WARNING_MESSAGE } = process.env;
module.exports = {
DATA_DIR,
TEMP_DIR,
UPLOAD_DIR,
PERIOD_TEMPLATES_DIR,
SERVER_CODE_DIR,
SERVER_DATA_DIR,
EMPTY_TEMPLATE_NAME,
POSTGRES_URL,
VERBOSE,
COOKIE_SECRET,
NODE_ENV,
IS_DEV,
LOGIN_EXPIRY_MINUTES,
PORT,
WEBSITE_DOMAIN,
ARPA_REPORTER_BASE_URL,
NOTIFICATIONS_EMAIL,
NOTIFICATIONS_EMAIL_PW,
NODEMAILER_HOST,
NODEMAILER_PORT,
AWS_ACCESS_KEY_ID,
AWS_SECRET_ACCESS_KEY,
LOGIN_DISABLED_MESSAGE,
LOGIN_WARNING_MESSAGE,
};
// NOTE: This file was copied from src/server/environment.js (git @ ada8bfdc98) in the arpa-reporter repo on 2022-09-23T20:05:47.735Z