-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconfig.js
40 lines (35 loc) · 1001 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
'use strict'
const _ = require('lodash'),
Env = require('dotenv').config(),
Confidence = require('confidence'),
ToBoolean = require('to-boolean')
const pack = require('./package')
const config = {
$meta: 'This file defines all configuration for project.',
name: pack.name,
version: pack.version,
description: pack.description,
app: {
host: process.env.APP_HOST || 'localhost',
port: process.env.APP_PORT || 3020
},
messenger: {
token: process.env.VERIFY_TOKEN || 'H@ck-d@y',
apiUrl: process.env.FB_API_URL || 'https://graph.facebook.com/v2.6',
messagePath: process.env.MESSAGE_PATH || '/me/messages',
accessToken: process.env.PAGE_ACCESS_TOKEN
},
logger: {
options: {
console: ToBoolean(_.defaultTo(process.env.LOGGER_DEBUG, true))
}
}
}
const store = new Confidence.Store(config),
criteria = {
env: process.env.APP_ENV
}
module.exports = {
get: key => store.get(key, criteria),
meta: key => store.meta(key, criteria)
}