@travetto/config 4.1.1 → 5.0.0-rc.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/LICENSE +1 -1
- package/README.md +11 -1
- package/package.json +4 -4
- package/src/parser/parser.ts +1 -1
- package/src/parser/yaml.ts +2 -2
- package/src/service.ts +1 -1
- package/src/source/file.ts +2 -1
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ npm install @travetto/config
|
|
|
13
13
|
yarn add @travetto/config
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
-
The config module provides support for loading application config on startup. Configuration values support the common [YAML](https://en.wikipedia.org/wiki/YAML) constructs as defined in [
|
|
16
|
+
The config module provides support for loading application config on startup. Configuration values support the common [YAML](https://en.wikipedia.org/wiki/YAML) constructs as defined in [yaml](https://github.com/eemeli/yaml). Additionally, the configuration is built upon the [Schema](https://github.com/travetto/travetto/tree/main/module/schema#readme "Data type registry for runtime validation, reflection and binding.") module, to enforce type correctness, and allow for validation of configuration as an entrypoint into the application. Given that all [@Config](https://github.com/travetto/travetto/tree/main/module/config/src/decorator.ts#L13) classes are [@Schema](https://github.com/travetto/travetto/tree/main/module/schema/src/decorator/schema.ts#L14)-based classes, all the standard [@Schema](https://github.com/travetto/travetto/tree/main/module/schema/src/decorator/schema.ts#L14) and [@Field](https://github.com/travetto/travetto/tree/main/module/schema/src/decorator/field.ts#L31) functionality applies.
|
|
17
17
|
|
|
18
18
|
## Resolution
|
|
19
19
|
The configuration information is comprised of:
|
|
@@ -76,6 +76,11 @@ Config {
|
|
|
76
76
|
{
|
|
77
77
|
priority: 100,
|
|
78
78
|
source: 'file://application',
|
|
79
|
+
detail: 'resources/application.yaml'
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
priority: 101,
|
|
83
|
+
source: 'file://application',
|
|
79
84
|
detail: 'module/config/doc/resources/application.yml'
|
|
80
85
|
},
|
|
81
86
|
{
|
|
@@ -229,6 +234,11 @@ Config {
|
|
|
229
234
|
{
|
|
230
235
|
priority: 100,
|
|
231
236
|
source: 'file://application',
|
|
237
|
+
detail: 'resources/application.yaml'
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
priority: 101,
|
|
241
|
+
source: 'file://application',
|
|
232
242
|
detail: 'module/config/doc/resources/application.yml'
|
|
233
243
|
},
|
|
234
244
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/config",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0-rc.0",
|
|
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": "^
|
|
30
|
-
"@travetto/schema": "^
|
|
31
|
-
"
|
|
29
|
+
"@travetto/di": "^5.0.0-rc.0",
|
|
30
|
+
"@travetto/schema": "^5.0.0-rc.0",
|
|
31
|
+
"yaml": "^2.4.5"
|
|
32
32
|
},
|
|
33
33
|
"travetto": {
|
|
34
34
|
"displayName": "Configuration"
|
package/src/parser/parser.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import fs from 'node:fs/promises';
|
|
2
|
+
import path from 'node:path';
|
|
2
3
|
|
|
3
4
|
import { DependencyRegistry, Injectable } from '@travetto/di';
|
|
4
5
|
import { AppError } from '@travetto/base';
|
|
5
|
-
import { path } from '@travetto/manifest';
|
|
6
6
|
|
|
7
7
|
import { ConfigParserTarget } from '../internal/types';
|
|
8
8
|
import { ConfigData, ConfigParser } from './types';
|
package/src/parser/yaml.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Injectable } from '@travetto/di';
|
|
2
|
-
import {
|
|
2
|
+
import { parse as parseYaml } from 'yaml';
|
|
3
3
|
|
|
4
4
|
import { ConfigParser } from './types';
|
|
5
5
|
|
|
6
6
|
@Injectable()
|
|
7
7
|
export class YAMLConfigParser implements ConfigParser {
|
|
8
8
|
ext = ['.yaml', '.yml'];
|
|
9
|
-
parse =
|
|
9
|
+
parse = parseYaml;
|
|
10
10
|
}
|
package/src/service.ts
CHANGED
package/src/source/file.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import fs from 'node:fs/promises';
|
|
2
|
+
import path from 'node:path';
|
|
2
3
|
|
|
3
4
|
import { Env, RuntimeResources } from '@travetto/base';
|
|
4
|
-
import { RuntimeContext
|
|
5
|
+
import { RuntimeContext } from '@travetto/manifest';
|
|
5
6
|
|
|
6
7
|
import { ConfigSource, ConfigSpec } from './types';
|
|
7
8
|
import { ParserManager } from '../parser/parser';
|