@backstage/config-loader 1.2.0 → 1.3.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/CHANGELOG.md +100 -0
- package/dist/index.cjs.js +1174 -375
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +440 -31
- package/package.json +7 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,105 @@
|
|
|
1
1
|
# @backstage/config-loader
|
|
2
2
|
|
|
3
|
+
## 1.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 201206132da: Introduced a new config source system to replace `loadConfig`. There is a new `ConfigSource` interface along with utilities provided by `ConfigSources`, as well as a number of built-in configuration source implementations. The new system is more flexible and makes it easier to create new and reusable sources of configuration, such as loading configuration from secret providers.
|
|
8
|
+
|
|
9
|
+
The following is an example of how to load configuration using the default behavior:
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
const source = ConfigSources.default({
|
|
13
|
+
argv: options?.argv,
|
|
14
|
+
remote: options?.remote,
|
|
15
|
+
});
|
|
16
|
+
const config = await ConfigSources.toConfig(source);
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
The `ConfigSource` interface looks like this:
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
export interface ConfigSource {
|
|
23
|
+
readConfigData(options?: ReadConfigDataOptions): AsyncConfigSourceIterator;
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
It is best implemented using an async iterator:
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
class MyConfigSource implements ConfigSource {
|
|
31
|
+
async *readConfigData() {
|
|
32
|
+
yield {
|
|
33
|
+
config: [
|
|
34
|
+
{
|
|
35
|
+
context: 'example',
|
|
36
|
+
data: { backend: { baseUrl: 'http://localhost' } },
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Patch Changes
|
|
45
|
+
|
|
46
|
+
- 7c116bcac7f: Fixed the way that some request errors are thrown
|
|
47
|
+
- 473db605a4f: Added a new `noUndeclaredProperties` option to `SchemaLoader` to support enforcing that there are no extra keys when verifying config.
|
|
48
|
+
- Updated dependencies
|
|
49
|
+
- @backstage/cli-common@0.1.12
|
|
50
|
+
- @backstage/config@1.0.7
|
|
51
|
+
- @backstage/errors@1.1.5
|
|
52
|
+
- @backstage/types@1.0.2
|
|
53
|
+
|
|
54
|
+
## 1.3.0-next.0
|
|
55
|
+
|
|
56
|
+
### Minor Changes
|
|
57
|
+
|
|
58
|
+
- 201206132da: Introduced a new config source system to replace `loadConfig`. There is a new `ConfigSource` interface along with utilities provided by `ConfigSources`, as well as a number of built-in configuration source implementations. The new system is more flexible and makes it easier to create new and reusable sources of configuration, such as loading configuration from secret providers.
|
|
59
|
+
|
|
60
|
+
The following is an example of how to load configuration using the default behavior:
|
|
61
|
+
|
|
62
|
+
```ts
|
|
63
|
+
const source = ConfigSources.default({
|
|
64
|
+
argv: options?.argv,
|
|
65
|
+
remote: options?.remote,
|
|
66
|
+
});
|
|
67
|
+
const config = await ConfigSources.toConfig(source);
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
The `ConfigSource` interface looks like this:
|
|
71
|
+
|
|
72
|
+
```ts
|
|
73
|
+
export interface ConfigSource {
|
|
74
|
+
readConfigData(options?: ReadConfigDataOptions): AsyncConfigSourceIterator;
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
It is best implemented using an async iterator:
|
|
79
|
+
|
|
80
|
+
```ts
|
|
81
|
+
class MyConfigSource implements ConfigSource {
|
|
82
|
+
async *readConfigData() {
|
|
83
|
+
yield {
|
|
84
|
+
config: [
|
|
85
|
+
{
|
|
86
|
+
context: 'example',
|
|
87
|
+
data: { backend: { baseUrl: 'http://localhost' } },
|
|
88
|
+
},
|
|
89
|
+
],
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Patch Changes
|
|
96
|
+
|
|
97
|
+
- Updated dependencies
|
|
98
|
+
- @backstage/cli-common@0.1.12
|
|
99
|
+
- @backstage/config@1.0.7
|
|
100
|
+
- @backstage/errors@1.1.5
|
|
101
|
+
- @backstage/types@1.0.2
|
|
102
|
+
|
|
3
103
|
## 1.2.0
|
|
4
104
|
|
|
5
105
|
### Minor Changes
|