-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
MainConfig.ts
138 lines (118 loc) · 2.84 KB
/
MainConfig.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
type Config = {
/**
* Required.
* Bot name in webex. Used across the code.
*/
botName: string
/**
* Required.
* Bot email in webex. Used across the code.
*/
botEmail: string
/**
* Bot admins in webex
*/
admins: string[]
/**
* Webex bot token required
*/
botAuthToken: string
/**
* The Google Apps Script webapp URL
*/
webAppHook: string
/**
* At least one email required.
* Team leads are added to the daily report email CC automatically.
*/
dailyReportTo: string[]
/**
* Managers are added to the daily report email CC.
* Also, managers are allowed to execute adminsOnly bot PublicCommands.
*/
managers: string[]
/**
* Id of the Webex space for daily status related notifications from bot.
*/
dailyStatusRoomId: string
/**
* Id of the Webex space for bot operation related notifications from bot.
*/
operationsRoomId: string
/**
* Id of the Webex space for debug messages from bot.
*/
debugRoomId: string
/**
* URL for the Help page with information for users.
*/
helpPageUrl: string
};
class MainConfig {
private static __config: Config;
private static defaultConfig: Config = {
botName: NotSpecified,
botEmail: NotSpecified,
admins: [NotSpecified],
botAuthToken: NotSpecified,
webAppHook: NotSpecified,
dailyReportTo: [],
managers: [],
dailyStatusRoomId: NotSpecified,
operationsRoomId: NotSpecified,
debugRoomId: NotSpecified,
helpPageUrl: NotSpecified,
};
// @ts-ignore
static get botName(): string {
return MainConfig.get().botName;
}
// @ts-ignore
static get botEmail(): string {
return MainConfig.get().botEmail;
}
// @ts-ignore
static get admins(): string[] {
return MainConfig.get().admins;
}
// @ts-ignore
static get calmBotAuthToken(): string {
return MainConfig.get().botAuthToken;
}
// @ts-ignore
static get webAppHook(): string {
return MainConfig.get().webAppHook;
}
// @ts-ignore
static get dailyReportTo(): string[] {
return MainConfig.get().dailyReportTo;
}
// @ts-ignore
static get managers(): string[] {
return MainConfig.get().managers;
}
// @ts-ignore
static get dailyStatusRoomId(): string {
return MainConfig.get().dailyStatusRoomId;
}
// @ts-ignore
static get operationsRoomId(): string {
return MainConfig.get().operationsRoomId;
}
// @ts-ignore
static get debugRoomId(): string {
return MainConfig.get().debugRoomId;
}
// @ts-ignore
static get helpPageUrl(): string {
return MainConfig.get().helpPageUrl;
}
static get(): Config {
if (!MainConfig.__config) {
const config = Store.get(Key.CONFIG, {});
MainConfig.__config = Object.assign(MainConfig.defaultConfig, config)
Store.set(Key.CONFIG, MainConfig.__config)
}
return MainConfig.__config;
}
}