@alacard-project/config-sdk 1.1.5 → 1.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -70,17 +70,13 @@ class ConfigClient {
|
|
|
70
70
|
async init() {
|
|
71
71
|
const { serviceName, environment, grpcUrl, version = 'v1', useDotenvFallback = true } = this.options;
|
|
72
72
|
try {
|
|
73
|
-
// 1. Load from Process Env (Highest Priority for overrides)
|
|
74
73
|
this.loadProcessEnv();
|
|
75
|
-
// 2. Load from DotEnv (if enabled)
|
|
76
74
|
if (useDotenvFallback) {
|
|
77
75
|
this.loadDotEnv(environment);
|
|
78
76
|
}
|
|
79
|
-
// 3. Load from Vault (if configured)
|
|
80
77
|
if (this.options.vault) {
|
|
81
78
|
await this.loadVaultSecrets(serviceName);
|
|
82
79
|
}
|
|
83
|
-
// 4. Fetch Remote Config via gRPC (with Circuit Breaker)
|
|
84
80
|
await this.fetchRemoteConfig(serviceName, environment, grpcUrl, version);
|
|
85
81
|
console.log(`[ConfigSDK] Configuration initialized with ${Object.keys(this.configMap).length} keys`);
|
|
86
82
|
}
|
|
@@ -6,7 +6,6 @@ const config_client_1 = require("../clients/config.client");
|
|
|
6
6
|
class BaseConfigService {
|
|
7
7
|
constructor() { }
|
|
8
8
|
get(key, defaultValue) {
|
|
9
|
-
// 1. Try Config Client (if initialized)
|
|
10
9
|
try {
|
|
11
10
|
const client = config_client_1.ConfigClient.getInstance();
|
|
12
11
|
const val = client.get(key);
|
|
@@ -15,9 +14,7 @@ class BaseConfigService {
|
|
|
15
14
|
}
|
|
16
15
|
}
|
|
17
16
|
catch (_e) {
|
|
18
|
-
// Client not initialized yet, fall through to process.env
|
|
19
17
|
}
|
|
20
|
-
// 2. Try process.env
|
|
21
18
|
const envVal = process.env[key];
|
|
22
19
|
if (envVal !== undefined) {
|
|
23
20
|
return envVal;
|