-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfig.ts
69 lines (66 loc) · 1.48 KB
/
config.ts
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
import * as convict from "convict";
// Define a schema
export let config = convict({
env: {
doc: "The application environment.",
format: ["production", "development", "test"],
default: "development",
env: "NODE_ENV",
},
twilio: {
accountSid: {
doc: "twilio Account ID",
default: "",
format: "String",
env: "TWILIO_ACCOUNT_ID",
},
authToken: {
doc: "twilio Auth Token",
format: "String",
default: "",
env: "TWILIO_AUTH_TOKEN",
},
isEnable: {
doc: "twilio Account ID",
default: false,
format: "Boolean",
env: "TWILIO_ENABLE",
},
},
influxdb: {
user: {
doc: "Influxdb admin user",
default: "admin",
format: "String",
env: "INFLUXDB_ADMIN_USER",
},
host: {
doc: "Influxdb host",
format: "String",
default: "localhost",
env: "INFLUXDB_HOST",
},
port: {
doc: "Influxdb port",
format: "String",
default: "8086",
env: "INFLUXDB_PORT",
},
password: {
doc: "Influxdb admin password",
format: "String",
default: "password",
env: "INFLUXDB_ADMIN_PASSWORD",
},
},
alertRecievers: {
format: "Array",
doc: "Array of Phone numbers to which alert should be send",
default: [],
},
});
// Load environment dependent configuration
let env = config.get("env");
config.loadFile("./config/" + env + ".json");
// Perform validation
config.validate({ allowed: "strict" });