forked from ChatAndSlash/Slashbot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
globals.js
36 lines (30 loc) · 883 Bytes
/
globals.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
"use strict";
// Load correct environment file
require('dotenv').config({ path: 'test' === process.env.NODE_ENV ? '.env-test' : '.env' });
global.CONTENT_FILES_PATH = __dirname + '/_content';
global._ = require('lodash');
// Can't believe this isn't defined already
global._.mixin({
isDefined: (value) => {
return ! _.isUndefined(value);
}
});
// Internationalization engine is in global scope
require("i18n").configure({
locales: ['en', 'fr'],
directory: __dirname + '/locales',
register: global,
});
// MySQL pooled connections
(async () => {
global.DB_POOL = await require('mysql2/promise').createPool({
host : process.env.DB_HOST,
user : process.env.DB_USER,
password : process.env.DB_PASS,
database : process.env.DB_DB,
multipleStatements: true,
charset: 'utf8mb4',
connectionLimit: 100,
queueLimit: 100,
});
})();