@rotty3000/config-node 0.5.1 → 0.6.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/README.md +28 -12
- package/dist/config-node/index.js +8 -4
- package/dist/config-node/index.js.map +1 -1
- package/dist/config-node/providers/1000-application-packaged.d.ts +1 -2
- package/dist/config-node/providers/1000-application-packaged.js +6 -15
- package/dist/config-node/providers/1000-application-packaged.js.map +1 -1
- package/dist/config-node/providers/11000-config-node-devtools.d.ts +7 -2
- package/dist/config-node/providers/11000-config-node-devtools.js +13 -12
- package/dist/config-node/providers/11000-config-node-devtools.js.map +1 -1
- package/dist/config-node/providers/2000-application.d.ts +1 -2
- package/dist/config-node/providers/2000-application.js +5 -11
- package/dist/config-node/providers/2000-application.js.map +1 -1
- package/dist/config-node/providers/3000-application-config.d.ts +1 -2
- package/dist/config-node/providers/3000-application-config.js +5 -11
- package/dist/config-node/providers/3000-application-config.js.map +1 -1
- package/dist/config-node/providers/4000-application-profile.d.ts +1 -2
- package/dist/config-node/providers/4000-application-profile.js +9 -19
- package/dist/config-node/providers/4000-application-profile.js.map +1 -1
- package/dist/config-node/providers/5000-application-profile-config.d.ts +1 -2
- package/dist/config-node/providers/5000-application-profile-config.js +9 -19
- package/dist/config-node/providers/5000-application-profile-config.js.map +1 -1
- package/dist/config-node/providers/6000-config-trees.js +1 -1
- package/dist/config-node/providers/6000-config-trees.js.map +1 -1
- package/dist/config-node/providers/7000-individual-env-vars.js +1 -1
- package/dist/config-node/providers/7000-individual-env-vars.js.map +1 -1
- package/dist/config-node/providers/active-profile.d.ts +5 -0
- package/dist/config-node/providers/active-profile.js +19 -0
- package/dist/config-node/providers/active-profile.js.map +1 -0
- package/dist/config-node/providers/json-file.d.ts +19 -0
- package/dist/config-node/providers/json-file.js +30 -0
- package/dist/config-node/providers/json-file.js.map +1 -0
- package/dist/config-node/util/index.d.ts +8 -3
- package/dist/config-node/util/index.js +12 -4
- package/dist/config-node/util/index.js.map +1 -1
- package/package.json +6 -7
- package/.github/workflows/node.js.yml +0 -30
- package/.nvmrc +0 -1
- package/RELEASE_PROCESS.md +0 -4
package/README.md
CHANGED
|
@@ -10,12 +10,12 @@ Optionally [custom providers](#custom-providers) can be added to search more exo
|
|
|
10
10
|
```typescript
|
|
11
11
|
import {lookupConfig, defaultConfig} from '@rotty3000/config-node';
|
|
12
12
|
|
|
13
|
-
//
|
|
13
|
+
// Look the value up where you need it rather than storing it: the first lookup is cached, and clearCache()
|
|
14
|
+
// (or a provider that refreshes its own cache) is how a value is brought up to date
|
|
14
15
|
let value = lookupConfig('a.configuration.key');
|
|
15
16
|
|
|
16
|
-
// Setting a default value to be used when no provider can locate a configured value
|
|
17
|
-
|
|
18
|
-
// do this before any access for the key has been performed
|
|
17
|
+
// Setting a default value to be used when no provider can locate a configured value. Do this as early as
|
|
18
|
+
// possible, ideally before the first lookup of that key.
|
|
19
19
|
defaultConfig('config.node.config.trees', ['/configtree']);
|
|
20
20
|
```
|
|
21
21
|
|
|
@@ -23,7 +23,7 @@ defaultConfig('config.node.config.trees', ['/configtree']);
|
|
|
23
23
|
|
|
24
24
|
The following configuration providers are pre-packaged and searched in order of precedence until a value is found.
|
|
25
25
|
|
|
26
|
-
1. A JSON file `~/.config-node-devtools.json` in the user home directory which contains configuration keys. (See [Structure of JSON configuration](#structure-of-json-configuration).)
|
|
26
|
+
1. A JSON file `~/.config-node-devtools.json` in the user home directory which contains configuration keys. It is a development convenience, so it is **not consulted when `NODE_ENV` is `production`**. (See [Structure of JSON configuration](#structure-of-json-configuration).)
|
|
27
27
|
1. Command line arguments formatted as `--key=value`.
|
|
28
28
|
1. From command line argument `--application.json=<json>` where the inline JSON is structured as in 1. (See [Structure of JSON configuration](#structure-of-json-configuration).)
|
|
29
29
|
1. Properties from the `APPLICATION_JSON` environment variable whose value is inline JSON. (See [Structure of JSON configuration](#structure-of-json-configuration).)
|
|
@@ -39,27 +39,39 @@ The following configuration providers are pre-packaged and searched in order of
|
|
|
39
39
|
The key `a-configuration-key` becomes an environment variable called `ACONFIGURATIONKEY`
|
|
40
40
|
1. From config tree structured directories (a.k.a. Volume mounted ConfigMaps/Secrets) specified (as an array) in the configuration property `config.node.config.trees`.
|
|
41
41
|
|
|
42
|
-
Setting the configuration property `config.node.config.trees` (using any of the sources described in this list, for instance as an environment variable `CONFIG_NODE_CONFIG_TREES=/config-map,/secrets`) indicates the directories where keys will be looked up (where _key_ matches the file name and file contents become the _value_).
|
|
42
|
+
Setting the configuration property `config.node.config.trees` (using any of the sources described in this list, for instance as an environment variable `CONFIG_NODE_CONFIG_TREES=/config-map,/secrets`) indicates the directories where keys will be looked up (where _key_ matches the file name and file contents become the _value_). A key is a single file name: it may not contain a path separator, and a resolved path or symlink that leaves the configured directory is refused.
|
|
43
43
|
|
|
44
44
|
_e.g._
|
|
45
45
|
|
|
46
|
-
Given a Kubernetes ConfigMap or Secret mounted at `/config-map` with a data file located at `/config-map/a.config.map.key`, looking up the property `a.config.map.key` will return the contents of the file as the value.
|
|
46
|
+
Given a Kubernetes ConfigMap or Secret mounted at `/config-map` with a data file located at `/config-map/a.config.map.key`, looking up the property `a.config.map.key` will return the contents of the file as the value (without the trailing newline the file carries).
|
|
47
47
|
1. From application profile property json files in `${CWD}/config/application-{profile}.json` where _profile_ is set using the property `config.node.profiles.active` (using any of the sources described in this list, for instance as an environment variable `CONFIG_NODE_PROFILES_ACTIVE=test`). (See [Structure of JSON configuration](#structure-of-json-configuration).)
|
|
48
48
|
1. From application profile property json files in `${CWD}/application-{profile}.json` where _profile_ is set using the property `config.node.profiles.active` (using any of the sources described in this list, for instance as an environment variable `CONFIG_NODE_PROFILES_ACTIVE=test`). (See [Structure of JSON configuration](#structure-of-json-configuration).)
|
|
49
49
|
1. From application property json files in `${CWD}/config/application.json`. (See [Structure of JSON configuration](#structure-of-json-configuration).)
|
|
50
50
|
1. From application property json files in `${CWD}/application.json`. (See [Structure of JSON configuration](#structure-of-json-configuration).)
|
|
51
|
-
1. From application property json files packaged with the node.js app
|
|
52
|
-
1. From
|
|
51
|
+
1. From application property json files packaged with the node.js app: the nearest `package.json` at or above the working directory, falling back to the directory of the main script. (See [Structure of JSON configuration](#structure-of-json-configuration).)
|
|
52
|
+
1. From programmer provided defaults. As demonstrated in the sample code above a developer can pre-set values to act as the defaults when no other source provides a value.
|
|
53
53
|
|
|
54
54
|
e.g.
|
|
55
55
|
```typescript
|
|
56
56
|
defaultConfig('my.custom.config', 'some value');
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
+
The properties `config.node.config.trees`, `config.node.profiles.active` and `config.node.config.verbose` are protected: the config tree and profile providers will never satisfy them for themselves, so the profiles and trees cannot be redefined by the very sources they configure.
|
|
60
|
+
|
|
61
|
+
## Value types
|
|
62
|
+
|
|
63
|
+
`lookupConfig` returns a `string`, a `string[]` or `undefined`.
|
|
64
|
+
|
|
65
|
+
* A JSON array of strings is returned as a `string[]`; any other array is returned as its JSON text.
|
|
66
|
+
* A JSON `false`, `0` or a number arrives as a string (`"false"`, `"0"`, `"5"`), because a provider answers with a falsy value when it has nothing to contribute. An empty array is not an answer and lets the search continue.
|
|
67
|
+
* A comma delimited value is split into a `string[]` **only for the flat text sources** — an environment variable and a file in a config tree. A JSON file can express an array for real, so a comma inside a JSON string value (`"Hello, world"`, a JDBC/PostgreSQL URL) stays part of that value.
|
|
68
|
+
|
|
59
69
|
## Interpolation of placeholders in config values
|
|
60
70
|
|
|
61
71
|
When a value returned from a lookup contains a placeholder of the form `${key}` the `key` will be looked up and its value, if found, will replace the placeholder. A single value may contain multiple placeholders and it is also possible to have nested placeholders. For example; given the two environment variables `VAR_ONE="env var one value"` and `VAR_TWO="ONE"`, a third property `nested.placeholder=${VAR_${VAR_TWO}}` would result in the value `env var one value`.
|
|
62
72
|
|
|
73
|
+
A placeholder that cannot be resolved is left in place as written, and a value that references itself (or that would keep re-substituting) stops after a bounded number of steps instead of looping. Treat `${...}` as a way to reference configuration you control: the placeholder names a key that is looked up through every source, so a value that arrives from an untrusted source should not be interpolated.
|
|
74
|
+
|
|
63
75
|
## Structure of JSON configuration
|
|
64
76
|
|
|
65
77
|
The configuration JSON structure expects keys to be at the root, as follows:
|
|
@@ -69,13 +81,13 @@ The configuration JSON structure expects keys to be at the root, as follows:
|
|
|
69
81
|
"key.with.array.value": ["one", "two"],
|
|
70
82
|
"key.with.object.value": {"some.value": "foo"},
|
|
71
83
|
"key.with.number.value": 5,
|
|
72
|
-
"key.with.string.value": "dev"
|
|
84
|
+
"key.with.string.value": "dev"
|
|
73
85
|
}
|
|
74
86
|
```
|
|
75
87
|
|
|
76
88
|
## Custom Providers
|
|
77
89
|
|
|
78
|
-
Custom providers can be added as
|
|
90
|
+
Custom providers can be added as middleware without affecting other parts of the code.
|
|
79
91
|
|
|
80
92
|
```typescript
|
|
81
93
|
import {addProvider, computeIfAbsent, ConfigProvider} from '@rotty3000/config-node';
|
|
@@ -100,6 +112,10 @@ const customProvider: ConfigProvider = {
|
|
|
100
112
|
addProvider(customProvider);
|
|
101
113
|
```
|
|
102
114
|
|
|
115
|
+
A provider signals "I have no value for this key" by returning a falsy value; the search then continues with the next provider. `priority` is compared numerically and the highest priority provider is asked first.
|
|
116
|
+
|
|
103
117
|
## Debugging and Verbosity
|
|
104
118
|
|
|
105
|
-
There is an internal property `config.node.config.verbose` which allows external operators to set the verbosity level of the library. When the value is set to `'true'` the library will emit additional information about
|
|
119
|
+
There is an internal property `config.node.config.verbose` which allows external operators to set the verbosity level of the library. When the value is set to `'true'` the library will emit additional information about its processing activities.
|
|
120
|
+
|
|
121
|
+
Values of sensitive keys (anything whose key contains `secret`, `password`, `token`, `credential` or an API/private key) are logged as `[redacted]`, and a configuration file that fails to parse is reported by path and reason, never by dumping its contents.
|
|
@@ -17,14 +17,15 @@ const util_1 = require("./util");
|
|
|
17
17
|
Object.defineProperty(exports, "computeIfAbsent", { enumerable: true, get: function () { return util_1.computeIfAbsent; } });
|
|
18
18
|
Object.defineProperty(exports, "setVerbose", { enumerable: true, get: function () { return util_1.setVerbose; } });
|
|
19
19
|
class ConfigProviderHolder {
|
|
20
|
+
priority;
|
|
21
|
+
provider;
|
|
22
|
+
cache;
|
|
20
23
|
constructor(provider) {
|
|
21
24
|
this.provider = provider;
|
|
22
25
|
this.priority = this.provider.priority;
|
|
23
26
|
this.cache = new Map;
|
|
24
27
|
}
|
|
25
28
|
}
|
|
26
|
-
class KeyProviderPair {
|
|
27
|
-
}
|
|
28
29
|
const configProviderHolders = [];
|
|
29
30
|
const commonCache = new Map();
|
|
30
31
|
const stack = [];
|
|
@@ -68,7 +69,7 @@ function defaultConfig(key, value) {
|
|
|
68
69
|
// a lookup made before this call (including the one this library performs when it is imported) may have
|
|
69
70
|
// cached the absence of a value for the key; drop that entry so the default is not shadowed by a stale miss
|
|
70
71
|
const programmaticHolder = configProviderHolders.find(holder => holder.provider === _0000_programmatic_1.programmatic);
|
|
71
|
-
programmaticHolder
|
|
72
|
+
programmaticHolder?.cache.delete(key);
|
|
72
73
|
}
|
|
73
74
|
exports.defaultConfig = defaultConfig;
|
|
74
75
|
/**
|
|
@@ -95,7 +96,7 @@ function lookupConfig(key) {
|
|
|
95
96
|
valueFromCache = true;
|
|
96
97
|
}
|
|
97
98
|
if (value) {
|
|
98
|
-
util_1.verbose && console.debug('[config-node]', `Provider [${holder.provider
|
|
99
|
+
util_1.verbose && console.debug('[config-node]', `Provider [${_providerLabel(holder.provider)}] returned${valueFromCache ? ' (from cache)' : ''}: `, key, '=', (0, util_1.redactValue)(key, value));
|
|
99
100
|
return value;
|
|
100
101
|
}
|
|
101
102
|
}
|
|
@@ -132,6 +133,9 @@ function _normalizeValue(value) {
|
|
|
132
133
|
}
|
|
133
134
|
return _interpolatePlaceholders(_stringify(value));
|
|
134
135
|
}
|
|
136
|
+
function _providerLabel(provider) {
|
|
137
|
+
return provider.description ? `${provider.key}: ${provider.description}` : provider.key;
|
|
138
|
+
}
|
|
135
139
|
function _stringify(value) {
|
|
136
140
|
try {
|
|
137
141
|
return JSON.stringify(value);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config-node/index.ts"],"names":[],"mappings":";;;AACA,wFAA0E;AAC1E,sDAA0C;AAC1C,sFAAyE;AACzE,sFAAyE;AACzE,oFAAuE;AACvE,sEAA0D;AAC1D,kGAAqF;AACrF,oFAAwE;AACxE,kFAAsE;AACtE,oEAAyD;AACzD,sFAA0E;AAC1E,sEAA2D;AAC3D,iCAAyE;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config-node/index.ts"],"names":[],"mappings":";;;AACA,wFAA0E;AAC1E,sDAA0C;AAC1C,sFAAyE;AACzE,sFAAyE;AACzE,oFAAuE;AACvE,sEAA0D;AAC1D,kGAAqF;AACrF,oFAAwE;AACxE,kFAAsE;AACtE,oEAAyD;AACzD,sFAA0E;AAC1E,sEAA2D;AAC3D,iCAAyE;AAkOxC,gGAlOzB,sBAAe,OAkOyB;AAA+C,2FAlOzD,iBAAU,OAkOyD;AAhOzG,MAAM,oBAAoB;IACf,QAAQ,CAAS;IACjB,QAAQ,CAAiB;IACzB,KAAK,CAAmB;IAEjC,YAAY,QAAwB;QAClC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAA;QACtC,IAAI,CAAC,KAAK,GAAG,IAAI,GAAgB,CAAC;IACpC,CAAC;CACF;AAOD,MAAM,qBAAqB,GAA2B,EAAE,CAAC;AACzD,MAAM,WAAW,GAAG,IAAI,GAAG,EAAe,CAAC;AAC3C,MAAM,KAAK,GAAsB,EAAE,CAAC;AACpC,MAAM,KAAK,GAAG,eAAe,CAAC;AAE9B;;;GAGG;AACH,MAAM,uBAAuB,GAAG,GAAG,CAAC;AAEpC;;;;GAIG;AACH,SAAS,WAAW,CAAC,GAAG,SAA2B;IACjD,SAAS,CAAC,OAAO,CAAC,QAAQ,CA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B,EAClB,6CAAiB,EACjB,gCAAW,EACX,2DAAwB,EACxB,8CAAkB,EAClB,4CAAiB,EACjB,+BAAW,EACX,gDAAmB,EACnB,iCAAY,CACb,CAAC;AAEF,IAAA,iBAAU,EAAC,YAAY,CAAC,4BAA4B,CAAC,KAAK,MAAM,CAAC,CAAC"}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const applicationPackaged: ConfigProvider;
|
|
1
|
+
export declare const applicationPackaged: import("..").ConfigProvider;
|
|
@@ -4,33 +4,24 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.applicationPackaged = void 0;
|
|
7
|
-
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
7
|
const node_path_1 = __importDefault(require("node:path"));
|
|
9
8
|
const util_1 = require("../util");
|
|
10
|
-
|
|
9
|
+
const json_file_1 = require("./json-file");
|
|
10
|
+
exports.applicationPackaged = (0, json_file_1.jsonFileProvider)({
|
|
11
11
|
key: 'application.json',
|
|
12
12
|
description: 'From application property json files packaged with the app',
|
|
13
13
|
priority: 500,
|
|
14
|
-
|
|
15
|
-
var _a, _b;
|
|
14
|
+
resolvePath: (commonCache) => {
|
|
16
15
|
let mainPath;
|
|
17
16
|
if (commonCache.has('require.main.path')) {
|
|
18
17
|
mainPath = commonCache.get('require.main.path');
|
|
19
18
|
}
|
|
20
19
|
else {
|
|
21
|
-
mainPath = (
|
|
20
|
+
mainPath = (0, util_1.getProjectRoot)() ?? require.main?.path;
|
|
22
21
|
// remember the miss as well: walking up to the filesystem root on every cold key is expensive
|
|
23
22
|
commonCache.set('require.main.path', mainPath);
|
|
24
23
|
}
|
|
25
|
-
|
|
26
|
-
const configPath = node_path_1.default.join(mainPath, 'application.json');
|
|
27
|
-
if (node_fs_1.default.existsSync(configPath)) {
|
|
28
|
-
const json = (0, util_1.computeIfAbsent)(providerCache, configPath, () => (0, util_1.readJSONFile)(configPath));
|
|
29
|
-
if (json) {
|
|
30
|
-
return (0, util_1.unquote)((0, util_1.readKey)(json, key));
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
24
|
+
return mainPath ? node_path_1.default.join(mainPath, 'application.json') : undefined;
|
|
34
25
|
},
|
|
35
|
-
};
|
|
26
|
+
});
|
|
36
27
|
//# sourceMappingURL=1000-application-packaged.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"1000-application-packaged.js","sourceRoot":"","sources":["../../../src/config-node/providers/1000-application-packaged.ts"],"names":[],"mappings":";;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"1000-application-packaged.js","sourceRoot":"","sources":["../../../src/config-node/providers/1000-application-packaged.ts"],"names":[],"mappings":";;;;;;AAAA,0DAA6B;AAC7B,kCAAuC;AACvC,2CAA6C;AAEhC,QAAA,mBAAmB,GAAG,IAAA,4BAAgB,EAAC;IAClD,GAAG,EAAE,kBAAkB;IACvB,WAAW,EAAE,4DAA4D;IACzE,QAAQ,EAAE,GAAG;IACb,WAAW,EAAE,CAAC,WAAW,EAAE,EAAE;QAC3B,IAAI,QAAQ,CAAC;QAEb,IAAI,WAAW,CAAC,GAAG,CAAC,mBAAmB,CAAC,EAAE,CAAC;YACzC,QAAQ,GAAG,WAAW,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;QAClD,CAAC;aACI,CAAC;YACJ,QAAQ,GAAG,IAAA,qBAAc,GAAE,IAAI,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC;YAClD,8FAA8F;YAC9F,WAAW,CAAC,GAAG,CAAC,mBAAmB,EAAE,QAAQ,CAAC,CAAC;QACjD,CAAC;QAED,OAAO,QAAQ,CAAC,CAAC,CAAC,mBAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACxE,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* A file in the user's home directory is a developer convenience, not configuration: it outranks every other
|
|
3
|
+
* source by design (that is what makes it useful for overriding a packaged default while debugging), which is
|
|
4
|
+
* also why it is not consulted in production where it would let whoever can write to $HOME take over the
|
|
5
|
+
* application's configuration.
|
|
6
|
+
*/
|
|
7
|
+
export declare const configNodeDevtools: import("..").ConfigProvider;
|
|
@@ -4,23 +4,24 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.configNodeDevtools = void 0;
|
|
7
|
-
const fs_1 = __importDefault(require("fs"));
|
|
8
7
|
const os_1 = __importDefault(require("os"));
|
|
9
8
|
const node_path_1 = __importDefault(require("node:path"));
|
|
10
9
|
const util_1 = require("../util");
|
|
11
|
-
|
|
10
|
+
const json_file_1 = require("./json-file");
|
|
11
|
+
/**
|
|
12
|
+
* A file in the user's home directory is a developer convenience, not configuration: it outranks every other
|
|
13
|
+
* source by design (that is what makes it useful for overriding a packaged default while debugging), which is
|
|
14
|
+
* also why it is not consulted in production where it would let whoever can write to $HOME take over the
|
|
15
|
+
* application's configuration.
|
|
16
|
+
*/
|
|
17
|
+
exports.configNodeDevtools = (0, json_file_1.jsonFileProvider)({
|
|
12
18
|
key: '~/.config-node-devtools.json',
|
|
13
19
|
description: 'From ~/.config-node-devtools.json',
|
|
14
20
|
priority: 11000,
|
|
15
|
-
|
|
21
|
+
isEnabled: () => process.env.NODE_ENV !== 'production',
|
|
22
|
+
resolvePath: (commonCache) => {
|
|
16
23
|
const homedir = (0, util_1.computeIfAbsent)(commonCache, 'homedir', () => os_1.default.homedir());
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
if (json) {
|
|
21
|
-
return (0, util_1.unquote)((0, util_1.readKey)(json, key));
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}),
|
|
25
|
-
};
|
|
24
|
+
return node_path_1.default.join(homedir, '.config-node-devtools.json');
|
|
25
|
+
},
|
|
26
|
+
});
|
|
26
27
|
//# sourceMappingURL=11000-config-node-devtools.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"11000-config-node-devtools.js","sourceRoot":"","sources":["../../../src/config-node/providers/11000-config-node-devtools.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AACpB,
|
|
1
|
+
{"version":3,"file":"11000-config-node-devtools.js","sourceRoot":"","sources":["../../../src/config-node/providers/11000-config-node-devtools.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AACpB,0DAA6B;AAC7B,kCAAwC;AACxC,2CAA6C;AAE7C;;;;;GAKG;AACU,QAAA,kBAAkB,GAAG,IAAA,4BAAgB,EAAC;IACjD,GAAG,EAAE,8BAA8B;IACnC,WAAW,EAAE,mCAAmC;IAChD,QAAQ,EAAE,KAAK;IACf,SAAS,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY;IACtD,WAAW,EAAE,CAAC,WAAW,EAAE,EAAE;QAC3B,MAAM,OAAO,GAAG,IAAA,sBAAe,EAAC,WAAW,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,YAAE,CAAC,OAAO,EAAE,CAAC,CAAC;QAE5E,OAAO,mBAAI,CAAC,IAAI,CAAC,OAAO,EAAE,4BAA4B,CAAC,CAAC;IAC1D,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const application: ConfigProvider;
|
|
1
|
+
export declare const application: import("..").ConfigProvider;
|
|
@@ -4,22 +4,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.application = void 0;
|
|
7
|
-
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
7
|
const node_path_1 = __importDefault(require("node:path"));
|
|
9
8
|
const util_1 = require("../util");
|
|
10
|
-
|
|
9
|
+
const json_file_1 = require("./json-file");
|
|
10
|
+
exports.application = (0, json_file_1.jsonFileProvider)({
|
|
11
11
|
key: '${CWD}/application.json',
|
|
12
12
|
description: 'From application property json files in ${CWD}',
|
|
13
13
|
priority: 2000,
|
|
14
|
-
|
|
14
|
+
resolvePath: (commonCache) => {
|
|
15
15
|
const cwd = (0, util_1.computeIfAbsent)(commonCache, 'cwd', () => process.cwd());
|
|
16
|
-
|
|
17
|
-
if (node_fs_1.default.existsSync(configPath)) {
|
|
18
|
-
const json = (0, util_1.computeIfAbsent)(providerCache, configPath, () => (0, util_1.readJSONFile)(configPath));
|
|
19
|
-
if (json) {
|
|
20
|
-
return (0, util_1.unquote)((0, util_1.readKey)(json, key));
|
|
21
|
-
}
|
|
22
|
-
}
|
|
16
|
+
return node_path_1.default.join(cwd, 'application.json');
|
|
23
17
|
},
|
|
24
|
-
};
|
|
18
|
+
});
|
|
25
19
|
//# sourceMappingURL=2000-application.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"2000-application.js","sourceRoot":"","sources":["../../../src/config-node/providers/2000-application.ts"],"names":[],"mappings":";;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"2000-application.js","sourceRoot":"","sources":["../../../src/config-node/providers/2000-application.ts"],"names":[],"mappings":";;;;;;AAAA,0DAA6B;AAC7B,kCAAwC;AACxC,2CAA6C;AAEhC,QAAA,WAAW,GAAG,IAAA,4BAAgB,EAAC;IAC1C,GAAG,EAAE,yBAAyB;IAC9B,WAAW,EAAE,gDAAgD;IAC7D,QAAQ,EAAE,IAAI;IACd,WAAW,EAAE,CAAC,WAAW,EAAE,EAAE;QAC3B,MAAM,GAAG,GAAG,IAAA,sBAAe,EAAC,WAAW,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QAErE,OAAO,mBAAI,CAAC,IAAI,CAAC,GAAG,EAAE,kBAAkB,CAAC,CAAC;IAC5C,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const applicationConfig: ConfigProvider;
|
|
1
|
+
export declare const applicationConfig: import("..").ConfigProvider;
|
|
@@ -4,22 +4,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.applicationConfig = void 0;
|
|
7
|
-
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
7
|
const node_path_1 = __importDefault(require("node:path"));
|
|
9
8
|
const util_1 = require("../util");
|
|
10
|
-
|
|
9
|
+
const json_file_1 = require("./json-file");
|
|
10
|
+
exports.applicationConfig = (0, json_file_1.jsonFileProvider)({
|
|
11
11
|
key: '${CWD}/config/application.json',
|
|
12
12
|
description: 'From application property json files in ${CWD}/config',
|
|
13
13
|
priority: 3000,
|
|
14
|
-
|
|
14
|
+
resolvePath: (commonCache) => {
|
|
15
15
|
const cwd = (0, util_1.computeIfAbsent)(commonCache, 'cwd', () => process.cwd());
|
|
16
|
-
|
|
17
|
-
if (node_fs_1.default.existsSync(configPath)) {
|
|
18
|
-
const json = (0, util_1.computeIfAbsent)(providerCache, configPath, () => (0, util_1.readJSONFile)(configPath));
|
|
19
|
-
if (json) {
|
|
20
|
-
return (0, util_1.unquote)((0, util_1.readKey)(json, key));
|
|
21
|
-
}
|
|
22
|
-
}
|
|
16
|
+
return node_path_1.default.join(cwd, 'config', 'application.json');
|
|
23
17
|
},
|
|
24
|
-
};
|
|
18
|
+
});
|
|
25
19
|
//# sourceMappingURL=3000-application-config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"3000-application-config.js","sourceRoot":"","sources":["../../../src/config-node/providers/3000-application-config.ts"],"names":[],"mappings":";;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"3000-application-config.js","sourceRoot":"","sources":["../../../src/config-node/providers/3000-application-config.ts"],"names":[],"mappings":";;;;;;AAAA,0DAA6B;AAC7B,kCAAwC;AACxC,2CAA6C;AAEhC,QAAA,iBAAiB,GAAG,IAAA,4BAAgB,EAAC;IAChD,GAAG,EAAE,gCAAgC;IACrC,WAAW,EAAE,uDAAuD;IACpE,QAAQ,EAAE,IAAI;IACd,WAAW,EAAE,CAAC,WAAW,EAAE,EAAE;QAC3B,MAAM,GAAG,GAAG,IAAA,sBAAe,EAAC,WAAW,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QAErE,OAAO,mBAAI,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,EAAE,kBAAkB,CAAC,CAAC;IACtD,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const applicationProfile: ConfigProvider;
|
|
1
|
+
export declare const applicationProfile: import("..").ConfigProvider;
|
|
@@ -5,31 +5,21 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.applicationProfile = void 0;
|
|
7
7
|
const node_path_1 = __importDefault(require("node:path"));
|
|
8
|
-
const config_node_1 = require("../../config-node");
|
|
9
8
|
const util_1 = require("../util");
|
|
10
|
-
|
|
9
|
+
const active_profile_1 = require("./active-profile");
|
|
10
|
+
const json_file_1 = require("./json-file");
|
|
11
|
+
exports.applicationProfile = (0, json_file_1.jsonFileProvider)({
|
|
11
12
|
key: '${CWD}/application-<profile>.json',
|
|
12
13
|
description: 'From application profile property json files in ${CWD}',
|
|
13
14
|
priority: 4000,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
let profile = (0, config_node_1.lookupConfig)('config.node.profiles.active');
|
|
15
|
+
isEnabled: (key) => !util_1.protectedKeys.includes(key),
|
|
16
|
+
resolvePath: (commonCache) => {
|
|
17
|
+
const profile = (0, active_profile_1.activeProfile)();
|
|
19
18
|
if (!profile) {
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
profile = Array.isArray(profile) ? profile[profile.length - 1] : profile;
|
|
23
|
-
// the profile name is pasted into a file name, so it must not be able to walk out of the directory
|
|
24
|
-
if (!(0, util_1.isSafePathSegment)(profile)) {
|
|
25
|
-
return;
|
|
19
|
+
return undefined;
|
|
26
20
|
}
|
|
27
21
|
const cwd = (0, util_1.computeIfAbsent)(commonCache, 'cwd', () => process.cwd());
|
|
28
|
-
|
|
29
|
-
const json = (0, util_1.computeIfAbsent)(providerCache, configPath, () => (0, util_1.readJSONFile)(configPath));
|
|
30
|
-
if (json) {
|
|
31
|
-
return (0, util_1.unquote)((0, util_1.readKey)(json, key));
|
|
32
|
-
}
|
|
22
|
+
return node_path_1.default.join(cwd, `application-${profile}.json`);
|
|
33
23
|
},
|
|
34
|
-
};
|
|
24
|
+
});
|
|
35
25
|
//# sourceMappingURL=4000-application-profile.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"4000-application-profile.js","sourceRoot":"","sources":["../../../src/config-node/providers/4000-application-profile.ts"],"names":[],"mappings":";;;;;;AAAA,0DAA6B;AAC7B,
|
|
1
|
+
{"version":3,"file":"4000-application-profile.js","sourceRoot":"","sources":["../../../src/config-node/providers/4000-application-profile.ts"],"names":[],"mappings":";;;;;;AAAA,0DAA6B;AAC7B,kCAAuD;AACvD,qDAA+C;AAC/C,2CAA6C;AAEhC,QAAA,kBAAkB,GAAG,IAAA,4BAAgB,EAAC;IACjD,GAAG,EAAE,mCAAmC;IACxC,WAAW,EAAE,wDAAwD;IACrE,QAAQ,EAAE,IAAI;IACd,SAAS,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,oBAAa,CAAC,QAAQ,CAAC,GAAG,CAAC;IAChD,WAAW,EAAE,CAAC,WAAW,EAAE,EAAE;QAC3B,MAAM,OAAO,GAAG,IAAA,8BAAa,GAAE,CAAC;QAEhC,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,MAAM,GAAG,GAAG,IAAA,sBAAe,EAAC,WAAW,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QAErE,OAAO,mBAAI,CAAC,IAAI,CAAC,GAAG,EAAE,eAAe,OAAO,OAAO,CAAC,CAAC;IACvD,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const applicationProfileConfig: ConfigProvider;
|
|
1
|
+
export declare const applicationProfileConfig: import("..").ConfigProvider;
|
|
@@ -5,31 +5,21 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.applicationProfileConfig = void 0;
|
|
7
7
|
const node_path_1 = __importDefault(require("node:path"));
|
|
8
|
-
const config_node_1 = require("../../config-node");
|
|
9
8
|
const util_1 = require("../util");
|
|
10
|
-
|
|
9
|
+
const active_profile_1 = require("./active-profile");
|
|
10
|
+
const json_file_1 = require("./json-file");
|
|
11
|
+
exports.applicationProfileConfig = (0, json_file_1.jsonFileProvider)({
|
|
11
12
|
key: '${CWD}/config/application-<profile>.json',
|
|
12
13
|
description: 'From application profile property json files in ${CWD}/config',
|
|
13
14
|
priority: 5000,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
let profile = (0, config_node_1.lookupConfig)('config.node.profiles.active');
|
|
15
|
+
isEnabled: (key) => !util_1.protectedKeys.includes(key),
|
|
16
|
+
resolvePath: (commonCache) => {
|
|
17
|
+
const profile = (0, active_profile_1.activeProfile)();
|
|
19
18
|
if (!profile) {
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
profile = Array.isArray(profile) ? profile[profile.length - 1] : profile;
|
|
23
|
-
// the profile name is pasted into a file name, so it must not be able to walk out of the directory
|
|
24
|
-
if (!(0, util_1.isSafePathSegment)(profile)) {
|
|
25
|
-
return;
|
|
19
|
+
return undefined;
|
|
26
20
|
}
|
|
27
21
|
const cwd = (0, util_1.computeIfAbsent)(commonCache, 'cwd', () => process.cwd());
|
|
28
|
-
|
|
29
|
-
const json = (0, util_1.computeIfAbsent)(providerCache, configPath, () => (0, util_1.readJSONFile)(configPath));
|
|
30
|
-
if (json) {
|
|
31
|
-
return (0, util_1.unquote)((0, util_1.readKey)(json, key));
|
|
32
|
-
}
|
|
22
|
+
return node_path_1.default.join(cwd, 'config', `application-${profile}.json`);
|
|
33
23
|
},
|
|
34
|
-
};
|
|
24
|
+
});
|
|
35
25
|
//# sourceMappingURL=5000-application-profile-config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"5000-application-profile-config.js","sourceRoot":"","sources":["../../../src/config-node/providers/5000-application-profile-config.ts"],"names":[],"mappings":";;;;;;AAAA,0DAA6B;AAC7B,
|
|
1
|
+
{"version":3,"file":"5000-application-profile-config.js","sourceRoot":"","sources":["../../../src/config-node/providers/5000-application-profile-config.ts"],"names":[],"mappings":";;;;;;AAAA,0DAA6B;AAC7B,kCAAuD;AACvD,qDAA+C;AAC/C,2CAA6C;AAEhC,QAAA,wBAAwB,GAAG,IAAA,4BAAgB,EAAC;IACvD,GAAG,EAAE,0CAA0C;IAC/C,WAAW,EAAE,+DAA+D;IAC5E,QAAQ,EAAE,IAAI;IACd,SAAS,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,oBAAa,CAAC,QAAQ,CAAC,GAAG,CAAC;IAChD,WAAW,EAAE,CAAC,WAAW,EAAE,EAAE;QAC3B,MAAM,OAAO,GAAG,IAAA,8BAAa,GAAE,CAAC;QAEhC,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,MAAM,GAAG,GAAG,IAAA,sBAAe,EAAC,WAAW,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QAErE,OAAO,mBAAI,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,EAAE,eAAe,OAAO,OAAO,CAAC,CAAC;IACjE,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -26,7 +26,7 @@ exports.configTrees = {
|
|
|
26
26
|
// real (symlink free) path: neither a `..` key nor a link can read outside the configured tree
|
|
27
27
|
const configtreeEntry = (0, util_1.resolveContainedFile)(configtree, key);
|
|
28
28
|
if (configtreeEntry) {
|
|
29
|
-
return (0, util_1.unquote)((0, util_1.trimFileValue)(node_fs_1.default.readFileSync(configtreeEntry, 'utf8')));
|
|
29
|
+
return (0, util_1.commaSeparated)((0, util_1.unquote)((0, util_1.trimFileValue)(node_fs_1.default.readFileSync(configtreeEntry, 'utf8'))));
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"6000-config-trees.js","sourceRoot":"","sources":["../../../src/config-node/providers/6000-config-trees.ts"],"names":[],"mappings":";;;;;;AAAA,sDAAyB;AACzB,mDAA+C;AAE/C,
|
|
1
|
+
{"version":3,"file":"6000-config-trees.js","sourceRoot":"","sources":["../../../src/config-node/providers/6000-config-trees.ts"],"names":[],"mappings":";;;;;;AAAA,sDAAyB;AACzB,mDAA+C;AAE/C,kCAEiB;AAEJ,QAAA,WAAW,GAAmB;IACzC,GAAG,EAAE,cAAc;IACnB,WAAW,EAAE,yEAAyE;IACtF,QAAQ,EAAE,IAAI;IACd,GAAG,EAAE,CAAC,GAAG,EAAE,aAAa,EAAE,EAAE;QAC1B,IAAI,oBAAa,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YAChC,OAAO;QACT,CAAC;QACD,IAAI,WAAW,GAAG,IAAA,0BAAY,EAAC,0BAA0B,CAAC,CAAC;QAC3D,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,OAAO;QACT,CAAC;QACD,WAAW,GAAG,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;QACvE,OAAO,IAAA,sBAAe,EAAC,aAAa,EAAE,cAAc,GAAG,EAAE,EAAE,GAAG,EAAE;YAC9D,KAAK,IAAI,UAAU,IAAI,WAAuB,EAAE,CAAC;gBAC/C,kGAAkG;gBAClG,+FAA+F;gBAC/F,MAAM,eAAe,GAAG,IAAA,2BAAoB,EAAC,UAAU,EAAE,GAAG,CAAC,CAAC;gBAE9D,IAAI,eAAe,EAAE,CAAC;oBACpB,OAAO,IAAA,qBAAc,EAAC,IAAA,cAAO,EAAC,IAAA,oBAAa,EAAC,iBAAE,CAAC,YAAY,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;gBAC1F,CAAC;YACH,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAC"}
|
|
@@ -10,7 +10,7 @@ exports.individualEnvVars = {
|
|
|
10
10
|
let modifiedKey = key.replace(/\./gi, '_');
|
|
11
11
|
modifiedKey = modifiedKey.replace(/-/gi, '');
|
|
12
12
|
modifiedKey = modifiedKey.toUpperCase();
|
|
13
|
-
return (0, util_1.unquote)(process.env[modifiedKey]);
|
|
13
|
+
return (0, util_1.commaSeparated)((0, util_1.unquote)(process.env[modifiedKey]));
|
|
14
14
|
}),
|
|
15
15
|
};
|
|
16
16
|
//# sourceMappingURL=7000-individual-env-vars.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"7000-individual-env-vars.js","sourceRoot":"","sources":["../../../src/config-node/providers/7000-individual-env-vars.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"7000-individual-env-vars.js","sourceRoot":"","sources":["../../../src/config-node/providers/7000-individual-env-vars.ts"],"names":[],"mappings":";;;AACA,kCAAiE;AAEpD,QAAA,iBAAiB,GAAmB;IAC/C,GAAG,EAAE,uBAAuB;IAC5B,WAAW,EAAE,uEAAuE;IACpF,QAAQ,EAAE,IAAI;IACd,GAAG,EAAE,CAAC,GAAG,EAAE,aAAa,EAAE,EAAE,CAAC,IAAA,sBAAe,EAAC,aAAa,EAAE,eAAe,GAAG,EAAE,EAAE,GAAG,EAAE;QACrF,IAAI,WAAW,GAAG,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAC3C,WAAW,GAAG,WAAW,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAC7C,WAAW,GAAG,WAAW,CAAC,WAAW,EAAE,CAAC;QACxC,OAAO,IAAA,qBAAc,EAAC,IAAA,cAAO,EAAC,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IAC3D,CAAC,CAAC;CACH,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The profile the application is running under, or undefined when there is none. A comma delimited list is
|
|
3
|
+
* reduced to its last entry, and a name that could walk out of the directory it is pasted into is refused.
|
|
4
|
+
*/
|
|
5
|
+
export declare function activeProfile(): string | undefined;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.activeProfile = void 0;
|
|
4
|
+
const config_node_1 = require("../../config-node");
|
|
5
|
+
const util_1 = require("../util");
|
|
6
|
+
/**
|
|
7
|
+
* The profile the application is running under, or undefined when there is none. A comma delimited list is
|
|
8
|
+
* reduced to its last entry, and a name that could walk out of the directory it is pasted into is refused.
|
|
9
|
+
*/
|
|
10
|
+
function activeProfile() {
|
|
11
|
+
const profile = (0, config_node_1.lookupConfig)('config.node.profiles.active');
|
|
12
|
+
if (!profile) {
|
|
13
|
+
return undefined;
|
|
14
|
+
}
|
|
15
|
+
const name = Array.isArray(profile) ? profile[profile.length - 1] : profile;
|
|
16
|
+
return (0, util_1.isSafePathSegment)(name) ? name : undefined;
|
|
17
|
+
}
|
|
18
|
+
exports.activeProfile = activeProfile;
|
|
19
|
+
//# sourceMappingURL=active-profile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"active-profile.js","sourceRoot":"","sources":["../../../src/config-node/providers/active-profile.ts"],"names":[],"mappings":";;;AAAA,mDAA+C;AAC/C,kCAA0C;AAE1C;;;GAGG;AACH,SAAgB,aAAa;IAC3B,MAAM,OAAO,GAAG,IAAA,0BAAY,EAAC,6BAA6B,CAAC,CAAC;IAE5D,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;IAE5E,OAAO,IAAA,wBAAiB,EAAC,IAAc,CAAC,CAAC,CAAC,CAAC,IAAc,CAAC,CAAC,CAAC,SAAS,CAAC;AACxE,CAAC;AAVD,sCAUC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ConfigProvider } from '../types';
|
|
2
|
+
export interface JsonFileProviderOptions {
|
|
3
|
+
/** The name this provider is reported under in verbose output. */
|
|
4
|
+
readonly key: string;
|
|
5
|
+
readonly description: string;
|
|
6
|
+
readonly priority: number;
|
|
7
|
+
/** Where the JSON file lives, or undefined when there is nothing to read for this lookup. */
|
|
8
|
+
readonly resolvePath: (commonCache: Map<string, any>) => string | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* Lets a provider decline a lookup outright, before anything is resolved or read (used for the keys a
|
|
11
|
+
* provider must never satisfy for itself, and for the developer only devtools file).
|
|
12
|
+
*/
|
|
13
|
+
readonly isEnabled?: (key: string) => boolean;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* The shape shared by every provider that reads one JSON file: resolve the path, parse the file once into the
|
|
17
|
+
* provider cache, and hand back one key from it.
|
|
18
|
+
*/
|
|
19
|
+
export declare function jsonFileProvider(options: JsonFileProviderOptions): ConfigProvider;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.jsonFileProvider = void 0;
|
|
4
|
+
const util_1 = require("../util");
|
|
5
|
+
/**
|
|
6
|
+
* The shape shared by every provider that reads one JSON file: resolve the path, parse the file once into the
|
|
7
|
+
* provider cache, and hand back one key from it.
|
|
8
|
+
*/
|
|
9
|
+
function jsonFileProvider(options) {
|
|
10
|
+
return {
|
|
11
|
+
key: options.key,
|
|
12
|
+
description: options.description,
|
|
13
|
+
priority: options.priority,
|
|
14
|
+
get: (key, providerCache, commonCache) => {
|
|
15
|
+
if (options.isEnabled && !options.isEnabled(key)) {
|
|
16
|
+
return undefined;
|
|
17
|
+
}
|
|
18
|
+
const configPath = options.resolvePath(commonCache);
|
|
19
|
+
if (!configPath) {
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
// readJSONFile already tolerates a missing file, so the parsed document (or its absence) is cached per
|
|
23
|
+
// path: the file is read at most once per process
|
|
24
|
+
const json = (0, util_1.computeIfAbsent)(providerCache, configPath, () => (0, util_1.readJSONFile)(configPath));
|
|
25
|
+
return json ? (0, util_1.unquote)((0, util_1.readKey)(json, key)) : undefined;
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
exports.jsonFileProvider = jsonFileProvider;
|
|
30
|
+
//# sourceMappingURL=json-file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-file.js","sourceRoot":"","sources":["../../../src/config-node/providers/json-file.ts"],"names":[],"mappings":";;;AACA,kCAAwE;AAgBxE;;;GAGG;AACH,SAAgB,gBAAgB,CAAC,OAAgC;IAC/D,OAAO;QACL,GAAG,EAAE,OAAO,CAAC,GAAG;QAChB,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,GAAG,EAAE,CAAC,GAAG,EAAE,aAAa,EAAE,WAAW,EAAE,EAAE;YACvC,IAAI,OAAO,CAAC,SAAS,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC;gBACjD,OAAO,SAAS,CAAC;YACnB,CAAC;YAED,MAAM,UAAU,GAAG,OAAO,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;YAEpD,IAAI,CAAC,UAAU,EAAE,CAAC;gBAChB,OAAO,SAAS,CAAC;YACnB,CAAC;YAED,uGAAuG;YACvG,kDAAkD;YAClD,MAAM,IAAI,GAAG,IAAA,sBAAe,EAAC,aAAa,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC,IAAA,mBAAY,EAAC,UAAU,CAAC,CAAC,CAAC;YAExF,OAAO,IAAI,CAAC,CAAC,CAAC,IAAA,cAAO,EAAC,IAAA,cAAO,EAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QACxD,CAAC;KACF,CAAC;AACJ,CAAC;AAvBD,4CAuBC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
declare let verbose: boolean;
|
|
2
2
|
declare const protectedKeys: string[];
|
|
3
|
-
declare function findProjectRoot(currentPath?: string): string;
|
|
3
|
+
declare function findProjectRoot(currentPath?: string): string | null;
|
|
4
4
|
/**
|
|
5
5
|
* A utility function to get the root folder of the parent project, use this function to get the application.json file
|
|
6
6
|
* when it's packaged in the client extension files.
|
|
7
7
|
* */
|
|
8
|
-
declare function getProjectRoot(): string;
|
|
8
|
+
declare function getProjectRoot(): string | null;
|
|
9
9
|
/**
|
|
10
10
|
* A utility function for providers that implements lazy computation of values when the cache does not contain the specified key.
|
|
11
11
|
*
|
|
@@ -49,4 +49,9 @@ declare function readJSONFile(filePath: string): Record<string, any> | undefined
|
|
|
49
49
|
*/
|
|
50
50
|
declare function setVerbose(b: boolean): void;
|
|
51
51
|
declare function unquote(it: any): any;
|
|
52
|
-
|
|
52
|
+
/**
|
|
53
|
+
* A comma delimited list is how the flat text sources express a list (an environment variable, or a file in a
|
|
54
|
+
* volume mounted ConfigMap); JSON sources can express an array for real, so they are not split this way.
|
|
55
|
+
*/
|
|
56
|
+
declare function commaSeparated(it: any): any;
|
|
57
|
+
export { commaSeparated, computeIfAbsent, findProjectRoot, getProjectRoot, isSafePathSegment, protectedKeys, readJSONFile, readKey, redactValue, resolveContainedFile, setVerbose, trimFileValue, unquote, verbose };
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.verbose = exports.unquote = exports.trimFileValue = exports.setVerbose = exports.resolveContainedFile = exports.redactValue = exports.readKey = exports.readJSONFile = exports.protectedKeys = exports.isSafePathSegment = exports.getProjectRoot = exports.findProjectRoot = exports.computeIfAbsent = void 0;
|
|
6
|
+
exports.verbose = exports.unquote = exports.trimFileValue = exports.setVerbose = exports.resolveContainedFile = exports.redactValue = exports.readKey = exports.readJSONFile = exports.protectedKeys = exports.isSafePathSegment = exports.getProjectRoot = exports.findProjectRoot = exports.computeIfAbsent = exports.commaSeparated = void 0;
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
8
|
const fs_1 = __importDefault(require("fs"));
|
|
9
9
|
let verbose = false;
|
|
@@ -164,11 +164,19 @@ function unquote(it) {
|
|
|
164
164
|
else if (it.startsWith('\'') && it.endsWith('\'')) {
|
|
165
165
|
return it.slice(1, -1);
|
|
166
166
|
}
|
|
167
|
-
if (it.includes(',')) {
|
|
168
|
-
return it.split(',');
|
|
169
|
-
}
|
|
170
167
|
}
|
|
171
168
|
return it;
|
|
172
169
|
}
|
|
173
170
|
exports.unquote = unquote;
|
|
171
|
+
/**
|
|
172
|
+
* A comma delimited list is how the flat text sources express a list (an environment variable, or a file in a
|
|
173
|
+
* volume mounted ConfigMap); JSON sources can express an array for real, so they are not split this way.
|
|
174
|
+
*/
|
|
175
|
+
function commaSeparated(it) {
|
|
176
|
+
if (typeof it === 'string' && it.includes(',')) {
|
|
177
|
+
return it.split(',');
|
|
178
|
+
}
|
|
179
|
+
return it;
|
|
180
|
+
}
|
|
181
|
+
exports.commaSeparated = commaSeparated;
|
|
174
182
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/config-node/util/index.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AACxB,4CAAoB;AAEpB,IAAI,OAAO,GAAY,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/config-node/util/index.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AACxB,4CAAoB;AAEpB,IAAI,OAAO,GAAY,KAAK,CAAC;AA2LmE,0BAAO;AAzLvG,MAAM,aAAa,GAAG;IACpB,0BAA0B;IAC1B,6BAA6B;IAC7B,4BAA4B;CAC7B,CAAC;AAoLqF,sCAAa;AAlLpG,MAAM,mBAAmB,GAAG,0EAA0E,CAAC;AAEvG,SAAS,eAAe,CAAC,WAAW,GAAG,OAAO,CAAC,GAAG,EAAE;IAClD,MAAM,cAAc,GAAG,YAAE,CAAC,UAAU,CAAC,cAAI,CAAC,IAAI,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC,CAAC;IAE7E,IAAI,cAAc,EAAE,CAAC;QACnB,OAAO,WAAW,CAAC;IACrB,CAAC;IAED,oGAAoG;IACpG,IAAI,cAAI,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK,WAAW,EAAE,CAAC;QAC9C,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,eAAe,CAAC,cAA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;QACzB,CAAC;aACI,IAAI,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;YAClD,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QACzB,CAAC;IACH,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC;AAesF,0BAAO;AAb9F;;;GAGG;AACH,SAAS,cAAc,CAAC,EAAO;IAC7B,IAAI,OAAO,EAAE,KAAK,QAAQ,IAAI,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QAC/C,OAAO,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACvB,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC;AAGC,wCAAc"}
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rotty3000/config-node",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "A library for obtaining external configuration for your application.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
|
+
"build": "tsc -p tsconfig.build.json",
|
|
9
|
+
"check": "tsc -p tsconfig.json",
|
|
8
10
|
"clean": "rm -rf dist",
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"run": "npm run clean && npm run build && node dist/src/index.js",
|
|
12
|
-
"test": "npm run clean && npm run build && ts-mocha test/*.ts"
|
|
11
|
+
"prepublishOnly": "npm run clean && npm run build",
|
|
12
|
+
"test": "npm run check && ts-mocha test/*.ts"
|
|
13
13
|
},
|
|
14
14
|
"author": "Raymond Augé",
|
|
15
15
|
"license": "Apache-2.0",
|
|
@@ -19,7 +19,6 @@
|
|
|
19
19
|
"@types/node": "^20.10.4",
|
|
20
20
|
"@types/sinon": "^17.0.2",
|
|
21
21
|
"chai": "^4.3.10",
|
|
22
|
-
"copyfiles": "^2.4.1",
|
|
23
22
|
"mocha": "^10.2.0",
|
|
24
23
|
"sinon": "^17.0.1",
|
|
25
24
|
"ts-mocha": "^10.0.0",
|
|
@@ -45,4 +44,4 @@
|
|
|
45
44
|
"url": "https://github.com/rotty3000/config-node/issues"
|
|
46
45
|
},
|
|
47
46
|
"homepage": "https://github.com/rotty3000/config-node#readme"
|
|
48
|
-
}
|
|
47
|
+
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
|
|
2
|
-
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
|
|
3
|
-
|
|
4
|
-
name: Node.js CI
|
|
5
|
-
|
|
6
|
-
on:
|
|
7
|
-
push:
|
|
8
|
-
branches: [ "main" ]
|
|
9
|
-
pull_request:
|
|
10
|
-
branches: [ "main" ]
|
|
11
|
-
|
|
12
|
-
jobs:
|
|
13
|
-
build:
|
|
14
|
-
|
|
15
|
-
runs-on: ubuntu-latest
|
|
16
|
-
|
|
17
|
-
strategy:
|
|
18
|
-
matrix:
|
|
19
|
-
node-version: [16.x, 18.x]
|
|
20
|
-
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
|
21
|
-
|
|
22
|
-
steps:
|
|
23
|
-
- uses: actions/checkout@v3
|
|
24
|
-
- name: Use Node.js ${{ matrix.node-version }}
|
|
25
|
-
uses: actions/setup-node@v3
|
|
26
|
-
with:
|
|
27
|
-
node-version: ${{ matrix.node-version }}
|
|
28
|
-
cache: 'npm'
|
|
29
|
-
- run: npm ci
|
|
30
|
-
- run: npm test
|
package/.nvmrc
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
v16.20.2
|
package/RELEASE_PROCESS.md
DELETED