config.ts 893 Bytes
Newer Older
1
2
3
4
5
6
export class Config {
  public apiUrl: string;
  public clientId: string;
  public clientKey: string;
  public filter: Record<string, any>;

7
8
9
10
11
  // module config
  public accession: BaseFeatureConfig;
  public language: Partial<LanguageConfig>;
  public request: BaseFeatureConfig;

12
13
14
15
16
17
18
19
  public constructor(config: Config) {
    this.apiUrl = config.apiUrl;
    this.clientId = config.clientId;
    this.clientKey = config.clientKey;
    this.filter = config.filter;
  }
}

20
21
22
23
24
25
26
27
28
export class BaseFeatureConfig {
  public enabled: boolean;
}

class LanguageConfig {
  public locale: string;
  public enableSwitch: boolean;
}

29
30
31
32
33
export const DefaultConfig = new Config( {
  apiUrl: 'https://api.sandbox.genesys-pgr.org',
  clientId: 'clientid@genesys',
  clientKey: 'changeme',
  filter: {},
34
35
36
  language: { locale: 'en', enableSwitch: true },
  accession: { enabled: true },
  request: { enabled: true },
37
})