-
Notifications
You must be signed in to change notification settings - Fork 1
/
Configuration.js
44 lines (39 loc) · 992 Bytes
/
Configuration.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
44
/**
* Singleton configuration class to be injected in services
*/
module.exports = class Configuration {
constructor() {
if (Configuration._instance) {
return Configuration._instance;
}
Configuration._instance = this;
// default properties
this.properties = {
usernameField: 'username',
usersCollection: 'users',
projectsCollection: 'projects',
annotationsCollection: 'annotations'
};
}
static getInstance() {
if(!Configuration._instance) {
Configuration._instance = new Configuration();
}
return Configuration._instance;
}
setProperties(properties) {
this.properties = properties;
}
get usernameField() {
return this.properties.usernameField;
}
get usersCollection() {
return this.properties.usersCollection;
}
get projectsCollection() {
return this.properties.projectsCollection;
}
get annotationsCollection() {
return this.properties.annotationsCollection;
}
};