-
Notifications
You must be signed in to change notification settings - Fork 111
Expand file tree
/
Copy pathconfig-summary.utils.ts
More file actions
69 lines (66 loc) · 2.38 KB
/
Copy pathconfig-summary.utils.ts
File metadata and controls
69 lines (66 loc) · 2.38 KB
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
import { maskSensitiveConfigValues } from './config-mask.utils';
/**
* Structured summary of the loaded runtime configuration, emitted once at
* startup. The summary is deliberately a curated subset of `envConfig` rather
* than a full dump: it surfaces the environment context and the key feature
* flags an operator needs to confirm how the process is configured, without
* the noise of every tuning knob.
*
* Values are sourced through {@link maskSensitiveConfigValues}, so even though
* only non-sensitive keys are selected here, any value that flows through is
* already redacted. No secrets, passwords, keys, tokens, or connection-string
* credentials are included.
*/
export interface StartupConfigSummary {
environment: {
mode: unknown;
port: unknown;
apiVersion: unknown;
stellarNetwork: unknown;
backendUrl: unknown;
frontendUrl: unknown;
};
featureFlags: {
responseTiming: unknown;
apiVersionHeader: unknown;
schemaVersionHeader: unknown;
requestLogging: unknown;
indexerDedupe: unknown;
indexerDlq: unknown;
indexerCursorStalenessWarning: unknown;
ownershipSnapshotCleanup: unknown;
};
}
/**
* Build the structured startup configuration summary.
*
* @example
* import { logger } from './utils/logger.utils';
* import { buildStartupConfigSummary } from './utils/config-summary.utils';
*
* logger.info(buildStartupConfigSummary(), 'Loaded runtime configuration');
*/
export function buildStartupConfigSummary(): StartupConfigSummary {
const config = maskSensitiveConfigValues();
return {
environment: {
mode: config.MODE,
port: config.PORT,
apiVersion: config.API_VERSION,
stellarNetwork: config.STELLAR_NETWORK,
backendUrl: config.BACKEND_URL,
frontendUrl: config.FRONTEND_URL,
},
featureFlags: {
responseTiming: config.ENABLE_RESPONSE_TIMING,
apiVersionHeader: config.ENABLE_API_VERSION_HEADER,
schemaVersionHeader: config.ENABLE_SCHEMA_VERSION_HEADER,
requestLogging: config.ENABLE_REQUEST_LOGGING,
indexerDedupe: config.ENABLE_INDEXER_DEDUPE,
indexerDlq: config.ENABLE_INDEXER_DLQ,
indexerCursorStalenessWarning:
config.ENABLE_INDEXER_CURSOR_STALENESS_WARNING,
ownershipSnapshotCleanup: config.OWNERSHIP_SNAPSHOT_CLEANUP_ENABLED,
},
};
}