-
Notifications
You must be signed in to change notification settings - Fork 3
/
flavor_config.ts
43 lines (34 loc) · 1013 Bytes
/
flavor_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
import { Flavor } from './flavor'
import { FlavorValues } from './flavor_values'
export interface IFlavorConfig {
flavor: Flavor
values: FlavorValues
}
export class FlavorConfig {
flavorType: Flavor
values: FlavorValues
private static _instance: FlavorConfig
private static _initialized = false
constructor(params: IFlavorConfig) {
this.flavorType = params.flavor
this.values = params.values
}
public static initialize(params: IFlavorConfig): FlavorConfig {
if (!this._initialized) {
FlavorConfig.instance = new FlavorConfig(params)
this._initialized = true
return FlavorConfig._instance
}
return this._instance
}
static isProd(): boolean {
return FlavorConfig._instance.flavorType == Flavor.prod
}
static isQA(): boolean {
return FlavorConfig._instance.flavorType == Flavor.qa
}
static isDEV(): boolean {
return FlavorConfig._instance.flavorType == Flavor.dev
}
static instance: FlavorConfig = FlavorConfig._instance
}