-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.js
43 lines (40 loc) · 1002 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
37
38
39
40
41
42
43
require('dotenv-safe').config({
allowEmptyValues: true,
example: '.env.example'
})
const configuration = {
BOT: {
token: process.env.TOKEN,
slashCommandType: process.env.SLASH_COMMANDS_TYPE,
id: process.env.ID
}
}
switch (process.env.DB) {
case 'mysql':
configuration.DB = {
_type: process.env.DB,
host: process.env.MYSQL_HOST,
username: process.env.MYSQL_USER,
password: process.env.MYSQL_PASSWORD,
database: process.env.MYSQL_DATABASE
}
break
case 'postgres':
configuration.DB = {
_type: process.env.DB,
connectionString: process.env.POSTGRES_CONNECTION_STRING
}
break
case 'mssql':
configuration.DB = {
_type: process.env.DB,
host: process.env.MSSQL_HOST,
username: process.env.MSSQL_USER,
password: process.env.MSSQL_PASSWORD,
database: process.env.MSSQL_DATABASE
}
break
default:
throw new Error('Invalid database type')
}
module.exports = configuration