forked from Jogurat/daljinac
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.js
27 lines (22 loc) · 905 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
require("dotenv").config();
let config = {};
config.PORT = process.env.PORT || 3000;
config.SECRET_KEY = process.env.SECRET_KEY || "secret_key";
config.EMAIL_SECRET = process.env.EMAIL_SECRET || "secret_email";
config.DB_HOST = process.env.DB_HOST || "http://localhost:3000/api";
config.FRONT_HOST = process.env.FRONT_HOST || "http://localhost:3000";
if (process.env.NODE_ENV == "development")
config.MONGODB_URI = "mongodb://localhost/actions";
else if (process.env.NODE_ENV == "test")
config.MONGODB_URI = "mongodb://localhost/testDB";
else config.MONGODB_URI = process.env.MONGODB_URI;
console.log("hi from config");
// const fs = require("fs");
// let json = JSON.stringify(config);
// if (!fs.existsSync("config.json")) {
// fs.writeFile("config.json", json, "utf8", (err) => {
// console.log(err);
// });
// console.log("I made the config file! :)");
// }
module.exports = config;