@backstage/config-loader 0.9.4 → 0.9.5

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 CHANGED
@@ -1,5 +1,16 @@
1
1
  # @backstage/config-loader
2
2
 
3
+ ## 0.9.5
4
+
5
+ ### Patch Changes
6
+
7
+ - Fix for the previous release with missing type declarations.
8
+ - Updated dependencies
9
+ - @backstage/cli-common@0.1.8
10
+ - @backstage/config@0.1.15
11
+ - @backstage/errors@0.2.2
12
+ - @backstage/types@0.1.3
13
+
3
14
  ## 0.9.4
4
15
 
5
16
  ### Patch Changes
@@ -0,0 +1,174 @@
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
+ * Whether or not to include the `deprecatedKeys` property in the output `AppConfig`s.
69
+ *
70
+ * Default: `true`.
71
+ */
72
+ withDeprecatedKeys?: boolean;
73
+ };
74
+ /**
75
+ * A loaded configuration schema that is ready to process configuration data.
76
+ *
77
+ * @public
78
+ */
79
+ declare type ConfigSchema = {
80
+ process(appConfigs: AppConfig[], options?: ConfigSchemaProcessingOptions): AppConfig[];
81
+ serialize(): JsonObject;
82
+ };
83
+
84
+ /**
85
+ * Given a list of configuration schemas from packages, merge them
86
+ * into a single json schema.
87
+ *
88
+ * @public
89
+ */
90
+ declare function mergeConfigSchemas(schemas: JSONSchema7[]): JSONSchema7;
91
+
92
+ /**
93
+ * Options that control the loading of configuration schema files in the backend.
94
+ *
95
+ * @public
96
+ */
97
+ declare type LoadConfigSchemaOptions = {
98
+ dependencies: string[];
99
+ packagePaths?: string[];
100
+ } | {
101
+ serialized: JsonObject;
102
+ };
103
+ /**
104
+ * Loads config schema for a Backstage instance.
105
+ *
106
+ * @public
107
+ */
108
+ declare function loadConfigSchema(options: LoadConfigSchemaOptions): Promise<ConfigSchema>;
109
+
110
+ /** @public */
111
+ declare type ConfigTarget = {
112
+ path: string;
113
+ } | {
114
+ url: string;
115
+ };
116
+ /** @public */
117
+ declare type LoadConfigOptionsWatch = {
118
+ /**
119
+ * A listener that is called when a config file is changed.
120
+ */
121
+ onChange: (configs: AppConfig[]) => void;
122
+ /**
123
+ * An optional signal that stops the watcher once the promise resolves.
124
+ */
125
+ stopSignal?: Promise<void>;
126
+ };
127
+ /** @public */
128
+ declare type LoadConfigOptionsRemote = {
129
+ /**
130
+ * A remote config reloading period, in seconds
131
+ */
132
+ reloadIntervalSeconds: number;
133
+ };
134
+ /**
135
+ * Options that control the loading of configuration files in the backend.
136
+ *
137
+ * @public
138
+ */
139
+ declare type LoadConfigOptions = {
140
+ configRoot: string;
141
+ configTargets: ConfigTarget[];
142
+ /**
143
+ * Custom environment variable loading function
144
+ *
145
+ * @experimental This API is not stable and may change at any point
146
+ */
147
+ experimentalEnvFunc?: (name: string) => Promise<string | undefined>;
148
+ /**
149
+ * An optional remote config
150
+ */
151
+ remote?: LoadConfigOptionsRemote;
152
+ /**
153
+ * An optional configuration that enables watching of config files.
154
+ */
155
+ watch?: LoadConfigOptionsWatch;
156
+ };
157
+ /**
158
+ * Results of loading configuration files.
159
+ * @public
160
+ */
161
+ declare type LoadConfigResult = {
162
+ /**
163
+ * Array of all loaded configs.
164
+ */
165
+ appConfigs: AppConfig[];
166
+ };
167
+ /**
168
+ * Load configuration data.
169
+ *
170
+ * @public
171
+ */
172
+ declare function loadConfig(options: LoadConfigOptions): Promise<LoadConfigResult>;
173
+
174
+ export { ConfigSchema, ConfigSchemaProcessingOptions, ConfigTarget, ConfigVisibility, LoadConfigOptions, LoadConfigOptionsRemote, LoadConfigOptionsWatch, LoadConfigResult, LoadConfigSchemaOptions, TransformFunc, loadConfig, loadConfigSchema, mergeConfigSchemas, readEnvConfig };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@backstage/config-loader",
3
3
  "description": "Config loading functionality used by Backstage backend, and CLI",
4
- "version": "0.9.4",
4
+ "version": "0.9.5",
5
5
  "private": false,
6
6
  "publishConfig": {
7
7
  "access": "public",
@@ -34,10 +34,10 @@
34
34
  "start": "backstage-cli package start"
35
35
  },
36
36
  "dependencies": {
37
- "@backstage/cli-common": "^0.1.7",
38
- "@backstage/config": "^0.1.14",
39
- "@backstage/errors": "^0.2.1",
40
- "@backstage/types": "^0.1.2",
37
+ "@backstage/cli-common": "^0.1.8",
38
+ "@backstage/config": "^0.1.15",
39
+ "@backstage/errors": "^0.2.2",
40
+ "@backstage/types": "^0.1.3",
41
41
  "@types/json-schema": "^7.0.6",
42
42
  "ajv": "^7.0.3",
43
43
  "chokidar": "^3.5.2",
@@ -62,6 +62,6 @@
62
62
  "files": [
63
63
  "dist"
64
64
  ],
65
- "gitHead": "4805c3d13ce9bfc369e53c271b1b95e722b3b4dc",
65
+ "gitHead": "e244b348c473700e7d5e5fbcef38bd9f9fd1d0ba",
66
66
  "module": "dist/index.esm.js"
67
67
  }