-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.js
36 lines (28 loc) · 945 Bytes
/
config.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
"use strict";
/** Shared config for application; can be required many places. */
require("dotenv").config();
require("colors");
const SECRET_KEY = process.env.SECRET_KEY;
const PORT = +process.env.PORT;
// Use dev database, testing database, or via env var, production database
function getDatabaseUri() {
return (process.env.NODE_ENV === "test")
? process.env.DBI_TEST_URI
: process.env.DBI_URI;
}
// Speed up bcrypt during tests, since the algorithm safety isn't being tested
const BCRYPT_WORK_FACTOR = process.env.NODE_ENV === "test"
? 1
: +process.env.PROD_BCRYPT_FACTOR;
console.log("Jobly Config:".green);
console.log("SECRET_KEY:".yellow, SECRET_KEY);
console.log("PORT:".yellow, PORT.toString());
console.log("BCRYPT_WORK_FACTOR".yellow, BCRYPT_WORK_FACTOR);
console.log("Database:".yellow, getDatabaseUri());
console.log("---");
module.exports = {
SECRET_KEY,
PORT,
BCRYPT_WORK_FACTOR,
getDatabaseUri
};