supaapps-config-fetcher 1.0.5 → 1.1.0
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.
- package/dist/ConfigManager.d.ts +1 -2
- package/dist/ConfigManager.js +2 -5
- package/package.json +1 -1
- package/src/ConfigManager.ts +3 -7
package/dist/ConfigManager.d.ts
CHANGED
package/dist/ConfigManager.js
CHANGED
|
@@ -12,7 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.ConfigManager = void 0;
|
|
13
13
|
const axios_1 = require("axios");
|
|
14
14
|
class ConfigManager {
|
|
15
|
-
constructor(appName, configHost = 'https://config.
|
|
15
|
+
constructor(appName, configHost = 'https://config.envdomain.com') {
|
|
16
16
|
this.config = null;
|
|
17
17
|
this.appName = appName;
|
|
18
18
|
this.configHost = configHost;
|
|
@@ -36,13 +36,10 @@ class ConfigManager {
|
|
|
36
36
|
}
|
|
37
37
|
catch (error) {
|
|
38
38
|
console.error("Failed to load config:", error);
|
|
39
|
-
|
|
39
|
+
throw new Error('Received invalid config data');
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
|
-
getConfig() {
|
|
44
|
-
return this.config;
|
|
45
|
-
}
|
|
46
43
|
}
|
|
47
44
|
exports.ConfigManager = ConfigManager;
|
|
48
45
|
ConfigManager.instances = {};
|
package/package.json
CHANGED
package/src/ConfigManager.ts
CHANGED
|
@@ -6,7 +6,7 @@ export class ConfigManager<T> {
|
|
|
6
6
|
private appName: string;
|
|
7
7
|
private configHost: string;
|
|
8
8
|
|
|
9
|
-
private constructor(appName: string, configHost: string = 'https://config.
|
|
9
|
+
private constructor(appName: string, configHost: string = 'https://config.envdomain.com') {
|
|
10
10
|
this.appName = appName;
|
|
11
11
|
this.configHost = configHost;
|
|
12
12
|
}
|
|
@@ -19,7 +19,7 @@ export class ConfigManager<T> {
|
|
|
19
19
|
return ConfigManager.instances[key] as ConfigManager<T>;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
public async loadConfig(): Promise<T
|
|
22
|
+
public async loadConfig(): Promise<T> {
|
|
23
23
|
if (this.config) return this.config;
|
|
24
24
|
try {
|
|
25
25
|
const host = typeof window !== 'undefined' ? window.location.hostname : 'localhost';
|
|
@@ -28,11 +28,7 @@ export class ConfigManager<T> {
|
|
|
28
28
|
return this.config;
|
|
29
29
|
} catch (error) {
|
|
30
30
|
console.error("Failed to load config:", error);
|
|
31
|
-
|
|
31
|
+
throw new Error('Received invalid config data');
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
|
|
35
|
-
public getConfig(): T | null {
|
|
36
|
-
return this.config;
|
|
37
|
-
}
|
|
38
34
|
}
|