Press n or j to go to the next uncovered block, b, p or k for the previous block.
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 | 2x 2x 2x 2x 2x 2x 2x 2x 4x 4x 1x 3x 3x 3x 3x 3x 3x 3x 3x 3x | export interface TelemetryConfig { application: string; domain: string; module: string; metrics: MetricsConfig; } export interface MetricsConfig { client: string; hostname: string; port: number; enabled: boolean; } export class Configuration { public static readonly defaultApp = ''; public static readonly defaultDomain = ''; public static readonly defaultModule = ''; public static readonly defaultMetricsClient = 'otlp'; public static readonly defaultMetricsHost = '127.0.0.1'; public static readonly defaultMetricsPort = 4317; public static readonly defaultMetricsEnabled = true; static initializeConfiguration(configJSON: string | undefined): TelemetryConfig { let config: TelemetryConfig; try { // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment config = JSON.parse(configJSON ?? '{}'); } catch (error) { return { application: this.defaultApp, domain: this.defaultDomain, module: this.defaultModule, metrics: { client: this.defaultMetricsClient, hostname: this.defaultMetricsHost, port: this.defaultMetricsPort, enabled: this.defaultMetricsEnabled, }, }; } config.application = config.application ?? this.defaultApp; config.domain = config.domain ?? this.defaultDomain; config.module = config.module ?? this.defaultModule; config.metrics = config.metrics ?? {}; config.metrics.client = config.metrics.client !== undefined ? config.metrics.client.toLowerCase() : this.defaultMetricsClient; config.metrics.hostname = config.metrics.hostname ?? this.defaultMetricsHost; config.metrics.port = config.metrics.port ?? this.defaultMetricsPort; config.metrics.enabled = config.metrics.enabled ?? this.defaultMetricsEnabled; return config; } } |