Version Packages (next)
This commit is contained in:
@@ -1,5 +1,54 @@
|
||||
# @backstage/config-loader
|
||||
|
||||
## 1.3.0-next.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- 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.
|
||||
|
||||
The following is an example of how to load configuration using the default behavior:
|
||||
|
||||
```ts
|
||||
const source = ConfigSources.default({
|
||||
argv: options?.argv,
|
||||
remote: options?.remote,
|
||||
});
|
||||
const config = await ConfigSources.toConfig(source);
|
||||
```
|
||||
|
||||
The `ConfigSource` interface looks like this:
|
||||
|
||||
```ts
|
||||
export interface ConfigSource {
|
||||
readConfigData(options?: ReadConfigDataOptions): AsyncConfigSourceIterator;
|
||||
}
|
||||
```
|
||||
|
||||
It is best implemented using an async iterator:
|
||||
|
||||
```ts
|
||||
class MyConfigSource implements ConfigSource {
|
||||
async *readConfigData() {
|
||||
yield {
|
||||
config: [
|
||||
{
|
||||
context: 'example',
|
||||
data: { backend: { baseUrl: 'http://localhost' } },
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- @backstage/cli-common@0.1.12
|
||||
- @backstage/config@1.0.7
|
||||
- @backstage/errors@1.1.5
|
||||
- @backstage/types@1.0.2
|
||||
|
||||
## 1.2.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@backstage/config-loader",
|
||||
"description": "Config loading functionality used by Backstage backend, and CLI",
|
||||
"version": "1.2.0",
|
||||
"version": "1.3.0-next.0",
|
||||
"publishConfig": {
|
||||
"access": "public",
|
||||
"main": "dist/index.cjs.js",
|
||||
|
||||
Reference in New Issue
Block a user