-
-
Notifications
You must be signed in to change notification settings - Fork 12
/
config.js
76 lines (69 loc) · 1.84 KB
/
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
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
/**
* Configuration module for managing environment-specific settings.
* @module config
* @type {Object}
*/
import dotenv from 'dotenv';
/**
* Loads environment variables from a .env file into process.env.
* @type {Function}
*/
dotenv.config();
/**
* Application configuration settings.
* @type {Object}
* @property {string} database - Name of the database.
* @property {number} serverPort - Port for the server.
* @property {string} serverHost - Host for the server.
* @property {Object} roles - User roles.
* @property {string} roles.DEVELOPER - Developer role.
* @property {string} roles.ADMIN - Admin role.
* @property {string} roles.MOD - Moderator role.
* @property {string} roles.DB_MOD - Database Moderator role.
* @property {string} roles.PREMIUM - Premium role.
* @property {string} roles.USER - User role.
*/
const config = {
/**
* Name of the database.
* @type {string}
* @default 'mydatabase'
*/
database: process.env.MONGODB_URI || 'mydatabase',
/**
* Port for the server.
* @type {number}
* @default 3000
*/
serverPort: process.env.PORT || 3000,
/**
* Host for the server.
* @type {string}
* @default '127.0.0.1'
*/
serverHost: process.env.HOST || 'http://localhost',
/**
* User roles.
* @type {Object}
* @property {string} DEVELOPER - Developer role.
* @property {string} ADMIN - Admin role.
* @property {string} MOD - Moderator role.
* @property {string} DB_MOD - Database Moderator role.
* @property {string} PREMIUM - Premium role.
* @property {string} USER - User role.
*/
roles: {
DEVELOPER: 'developer',
ADMIN: 'admin',
MOD: 'moderator',
DB_MOD: 'database_moderator',
PREMIUM: 'premium',
USER: 'user',
},
};
/**
* Global configuration object based on the current environment.
* @global
* @type {Object}
*/
global.config = config;