@backstage/config-loader 0.9.1 → 0.9.4
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 +66 -0
- package/dist/index.cjs.js +29 -7
- package/dist/index.cjs.js.map +1 -1
- package/package.json +17 -13
- package/dist/index.d.ts +0 -165
- package/dist/index.esm.js +0 -715
- package/dist/index.esm.js.map +0 -1
package/dist/index.d.ts
DELETED
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
import { AppConfig } from '@backstage/config';
|
|
2
|
-
import { JSONSchema7 } from 'json-schema';
|
|
3
|
-
import { JsonObject } from '@backstage/types';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Read runtime configuration from the environment.
|
|
7
|
-
*
|
|
8
|
-
* Only environment variables prefixed with APP_CONFIG_ will be considered.
|
|
9
|
-
*
|
|
10
|
-
* For each variable, the prefix will be removed, and rest of the key will
|
|
11
|
-
* be split by '_'. Each part will then be used as keys to build up a nested
|
|
12
|
-
* config object structure. The treatment of the entire environment variable
|
|
13
|
-
* is case-sensitive.
|
|
14
|
-
*
|
|
15
|
-
* The value of the variable should be JSON serialized, as it will be parsed
|
|
16
|
-
* and the type will be kept intact. For example "true" and true are treated
|
|
17
|
-
* differently, as well as "42" and 42.
|
|
18
|
-
*
|
|
19
|
-
* For example, to set the config app.title to "My Title", use the following:
|
|
20
|
-
*
|
|
21
|
-
* APP_CONFIG_app_title='"My Title"'
|
|
22
|
-
*
|
|
23
|
-
* @public
|
|
24
|
-
*/
|
|
25
|
-
declare function readEnvConfig(env: {
|
|
26
|
-
[name: string]: string | undefined;
|
|
27
|
-
}): AppConfig[];
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* A type representing the possible configuration value visibilities
|
|
31
|
-
*
|
|
32
|
-
* @public
|
|
33
|
-
*/
|
|
34
|
-
declare type ConfigVisibility = 'frontend' | 'backend' | 'secret';
|
|
35
|
-
/**
|
|
36
|
-
* A function used to transform primitive configuration values.
|
|
37
|
-
*
|
|
38
|
-
* @public
|
|
39
|
-
*/
|
|
40
|
-
declare type TransformFunc<T extends number | string | boolean> = (value: T, context: {
|
|
41
|
-
visibility: ConfigVisibility;
|
|
42
|
-
}) => T | undefined;
|
|
43
|
-
/**
|
|
44
|
-
* Options used to process configuration data with a schema.
|
|
45
|
-
*
|
|
46
|
-
* @public
|
|
47
|
-
*/
|
|
48
|
-
declare type ConfigSchemaProcessingOptions = {
|
|
49
|
-
/**
|
|
50
|
-
* The visibilities that should be included in the output data.
|
|
51
|
-
* If omitted, the data will not be filtered by visibility.
|
|
52
|
-
*/
|
|
53
|
-
visibility?: ConfigVisibility[];
|
|
54
|
-
/**
|
|
55
|
-
* A transform function that can be used to transform primitive configuration values
|
|
56
|
-
* during validation. The value returned from the transform function will be used
|
|
57
|
-
* instead of the original value. If the transform returns `undefined`, the value
|
|
58
|
-
* will be omitted.
|
|
59
|
-
*/
|
|
60
|
-
valueTransform?: TransformFunc<any>;
|
|
61
|
-
/**
|
|
62
|
-
* Whether or not to include the `filteredKeys` property in the output `AppConfig`s.
|
|
63
|
-
*
|
|
64
|
-
* Default: `false`.
|
|
65
|
-
*/
|
|
66
|
-
withFilteredKeys?: boolean;
|
|
67
|
-
};
|
|
68
|
-
/**
|
|
69
|
-
* A loaded configuration schema that is ready to process configuration data.
|
|
70
|
-
*
|
|
71
|
-
* @public
|
|
72
|
-
*/
|
|
73
|
-
declare type ConfigSchema = {
|
|
74
|
-
process(appConfigs: AppConfig[], options?: ConfigSchemaProcessingOptions): AppConfig[];
|
|
75
|
-
serialize(): JsonObject;
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Given a list of configuration schemas from packages, merge them
|
|
80
|
-
* into a single json schema.
|
|
81
|
-
*
|
|
82
|
-
* @public
|
|
83
|
-
*/
|
|
84
|
-
declare function mergeConfigSchemas(schemas: JSONSchema7[]): JSONSchema7;
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Options that control the loading of configuration schema files in the backend.
|
|
88
|
-
*
|
|
89
|
-
* @public
|
|
90
|
-
*/
|
|
91
|
-
declare type LoadConfigSchemaOptions = {
|
|
92
|
-
dependencies: string[];
|
|
93
|
-
packagePaths?: string[];
|
|
94
|
-
} | {
|
|
95
|
-
serialized: JsonObject;
|
|
96
|
-
};
|
|
97
|
-
/**
|
|
98
|
-
* Loads config schema for a Backstage instance.
|
|
99
|
-
*
|
|
100
|
-
* @public
|
|
101
|
-
*/
|
|
102
|
-
declare function loadConfigSchema(options: LoadConfigSchemaOptions): Promise<ConfigSchema>;
|
|
103
|
-
|
|
104
|
-
declare type ConfigTarget = {
|
|
105
|
-
path: string;
|
|
106
|
-
} | {
|
|
107
|
-
url: string;
|
|
108
|
-
};
|
|
109
|
-
declare type LoadConfigOptionsWatch = {
|
|
110
|
-
/**
|
|
111
|
-
* A listener that is called when a config file is changed.
|
|
112
|
-
*/
|
|
113
|
-
onChange: (configs: AppConfig[]) => void;
|
|
114
|
-
/**
|
|
115
|
-
* An optional signal that stops the watcher once the promise resolves.
|
|
116
|
-
*/
|
|
117
|
-
stopSignal?: Promise<void>;
|
|
118
|
-
};
|
|
119
|
-
declare type LoadConfigOptionsRemote = {
|
|
120
|
-
/**
|
|
121
|
-
* A remote config reloading period, in seconds
|
|
122
|
-
*/
|
|
123
|
-
reloadIntervalSeconds: number;
|
|
124
|
-
};
|
|
125
|
-
/**
|
|
126
|
-
* Options that control the loading of configuration files in the backend.
|
|
127
|
-
*
|
|
128
|
-
* @public
|
|
129
|
-
*/
|
|
130
|
-
declare type LoadConfigOptions = {
|
|
131
|
-
configRoot: string;
|
|
132
|
-
configTargets: ConfigTarget[];
|
|
133
|
-
/**
|
|
134
|
-
* Custom environment variable loading function
|
|
135
|
-
*
|
|
136
|
-
* @experimental This API is not stable and may change at any point
|
|
137
|
-
*/
|
|
138
|
-
experimentalEnvFunc?: (name: string) => Promise<string | undefined>;
|
|
139
|
-
/**
|
|
140
|
-
* An optional remote config
|
|
141
|
-
*/
|
|
142
|
-
remote?: LoadConfigOptionsRemote;
|
|
143
|
-
/**
|
|
144
|
-
* An optional configuration that enables watching of config files.
|
|
145
|
-
*/
|
|
146
|
-
watch?: LoadConfigOptionsWatch;
|
|
147
|
-
};
|
|
148
|
-
/**
|
|
149
|
-
* Results of loading configuration files.
|
|
150
|
-
* @public
|
|
151
|
-
*/
|
|
152
|
-
declare type LoadConfigResult = {
|
|
153
|
-
/**
|
|
154
|
-
* Array of all loaded configs.
|
|
155
|
-
*/
|
|
156
|
-
appConfigs: AppConfig[];
|
|
157
|
-
};
|
|
158
|
-
/**
|
|
159
|
-
* Load configuration data.
|
|
160
|
-
*
|
|
161
|
-
* @public
|
|
162
|
-
*/
|
|
163
|
-
declare function loadConfig(options: LoadConfigOptions): Promise<LoadConfigResult>;
|
|
164
|
-
|
|
165
|
-
export { ConfigSchema, ConfigSchemaProcessingOptions, ConfigTarget, ConfigVisibility, LoadConfigOptions, LoadConfigOptionsRemote, LoadConfigOptionsWatch, LoadConfigResult, LoadConfigSchemaOptions, TransformFunc, loadConfig, loadConfigSchema, mergeConfigSchemas, readEnvConfig };
|