-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.js
33 lines (25 loc) · 863 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
"use strict";
require("dotenv").config();
require("colors");
const SECRET_KEY = process.env.SECRET_KEY || "secret-key";
const PORT = +process.env.PORT || 3003;
function getDatabaseUri() {
return process.env.NODE_ENV === "test"
? "trynance_test"
: process.env.DATABASE_URL || "trynance";
}
//Lower bcrypt's work factor during test and raise during production.
const BCRYPT_WORK_FACTOR = process.env.NODE_ENV === "test" ? 1 : 12;
console.log("------------------------------");
console.log("Tryance 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:".blue, getDatabaseUri());
console.log("------------------------------")
module.exports = {
SECRET_KEY,
PORT,
BCRYPT_WORK_FACTOR,
getDatabaseUri,
}