-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.js
32 lines (27 loc) · 915 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
"use strict";
require("dotenv").config();
require("colors");
const API_KEY_ANIMALS = process.env.API_KEY_ANIMALS;
const API_KEY_PHOTOS = process.env.API_KEY_PHOTOS;
const PORT = +process.env.PORT || 3001;
const SECRET_KEY = process.env.SECRET_KEY || "animals";
const BCRYPT_WORK_FACTOR = process.env.NODE_ENV === "test" ? 1 : 12;
function getDatabaseUri() {
return (process.env.NODE_ENV === "test")
? "critterclub_test"
: process.env.DATABASE_URL || "critterclub";
}
console.log("Config:".green);
console.log("API_KEY_ANIMALS:".yellow, API_KEY_ANIMALS);
console.log("API_KEY_PHOTOS:".yellow, API_KEY_PHOTOS);
console.log("BCRYPT_WORK_FACTOR".yellow, BCRYPT_WORK_FACTOR);
console.log("PORT:".yellow, PORT.toString());
console.log("Database:".yellow, getDatabaseUri());
module.exports = {
API_KEY_ANIMALS,
API_KEY_PHOTOS,
PORT,
SECRET_KEY,
BCRYPT_WORK_FACTOR,
getDatabaseUri
}