@travetto/config 6.0.0 → 6.0.1
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/package.json +4 -4
- package/src/service.ts +12 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/config",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.1",
|
|
4
4
|
"description": "Configuration support",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"yaml",
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
"directory": "module/config"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@travetto/di": "^6.0.
|
|
30
|
-
"@travetto/schema": "^6.0.
|
|
31
|
-
"yaml": "^2.
|
|
29
|
+
"@travetto/di": "^6.0.1",
|
|
30
|
+
"@travetto/schema": "^6.0.1",
|
|
31
|
+
"yaml": "^2.8.1"
|
|
32
32
|
},
|
|
33
33
|
"travetto": {
|
|
34
34
|
"displayName": "Configuration"
|
package/src/service.ts
CHANGED
|
@@ -31,7 +31,7 @@ export class ConfigurationService {
|
|
|
31
31
|
* Get a sub tree of the config, or everything if namespace is not passed
|
|
32
32
|
* @param ns The namespace of the config to search for, can be dotted for accessing sub namespaces
|
|
33
33
|
*/
|
|
34
|
-
#get
|
|
34
|
+
#get<T extends Record<string, unknown> = Record<string, unknown>>(ns?: string): T {
|
|
35
35
|
const parts = (ns ? ns.split('.') : []);
|
|
36
36
|
let sub: Record<string, unknown> = this.#storage;
|
|
37
37
|
|
|
@@ -40,7 +40,7 @@ export class ConfigurationService {
|
|
|
40
40
|
sub = castTo(sub[next]);
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
return sub;
|
|
43
|
+
return castTo(sub);
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
/**
|
|
@@ -76,9 +76,9 @@ export class ConfigurationService {
|
|
|
76
76
|
this.#specs = specs.map(({ data: _, ...v }) => v);
|
|
77
77
|
|
|
78
78
|
// Initialize Secrets
|
|
79
|
-
const
|
|
80
|
-
for (const el of
|
|
81
|
-
if (
|
|
79
|
+
const { secrets = [] } = this.#get<{ secrets?: string | string[] }>('config') ?? {};
|
|
80
|
+
for (const el of [secrets].flat()) {
|
|
81
|
+
if (typeof el === 'string') {
|
|
82
82
|
if (el.startsWith('/')) {
|
|
83
83
|
this.#secrets.push(DataUtil.coerceType(el, RegExp, true));
|
|
84
84
|
} else {
|
|
@@ -140,13 +140,10 @@ export class ConfigurationService {
|
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
/**
|
|
143
|
-
*
|
|
143
|
+
* Produce the visible configuration state and runtime information
|
|
144
144
|
*/
|
|
145
|
-
async initBanner(): Promise<
|
|
146
|
-
|
|
147
|
-
util.inspect.defaultOptions.depth = 100;
|
|
148
|
-
|
|
149
|
-
console.log('Initialized', {
|
|
145
|
+
async initBanner(): Promise<string> {
|
|
146
|
+
return util.inspect({
|
|
150
147
|
manifest: {
|
|
151
148
|
main: Runtime.main,
|
|
152
149
|
workspace: Runtime.workspace
|
|
@@ -160,7 +157,10 @@ export class ConfigurationService {
|
|
|
160
157
|
profiles: Env.TRV_PROFILES.list ?? []
|
|
161
158
|
},
|
|
162
159
|
config: await this.exportActive()
|
|
160
|
+
}, {
|
|
161
|
+
...util.inspect.defaultOptions,
|
|
162
|
+
depth: 100,
|
|
163
|
+
colors: false, // Colors are not useful in logs
|
|
163
164
|
});
|
|
164
|
-
util.inspect.defaultOptions.depth = ogDepth;
|
|
165
165
|
}
|
|
166
166
|
}
|