@tramvai/module-environment 4.27.1 → 4.29.1
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.
|
@@ -89,11 +89,16 @@ class EnvironmentManagerServer extends EnvironmentManager {
|
|
|
89
89
|
const envParameters = this.collectionEnv();
|
|
90
90
|
this.tokens.forEach(({ key, validator = noop, optional }) => {
|
|
91
91
|
const value = envParameters[key];
|
|
92
|
+
const interpolatedValue = interpolate({
|
|
93
|
+
envKey: key,
|
|
94
|
+
envValue: value,
|
|
95
|
+
templates: this.templates,
|
|
96
|
+
});
|
|
92
97
|
if (typeof value === 'undefined' && !optional) {
|
|
93
98
|
throw new Error(`Env parameter ${key} not found. You need add a this env parameter. If you have questions read the docs`);
|
|
94
99
|
}
|
|
95
100
|
// Not calling validation on empty values.
|
|
96
|
-
const validation = typeof
|
|
101
|
+
const validation = typeof interpolatedValue !== 'undefined' && validator(interpolatedValue);
|
|
97
102
|
if (typeof validation === 'string') {
|
|
98
103
|
throw new Error(`Env parameter ${key} with value ${value} not valid, message: ${validation}`);
|
|
99
104
|
}
|
|
@@ -97,11 +97,16 @@ class EnvironmentManagerServer extends EnvironmentManager.EnvironmentManager {
|
|
|
97
97
|
const envParameters = this.collectionEnv();
|
|
98
98
|
this.tokens.forEach(({ key, validator = noop__default["default"], optional }) => {
|
|
99
99
|
const value = envParameters[key];
|
|
100
|
+
const interpolatedValue = template.interpolate({
|
|
101
|
+
envKey: key,
|
|
102
|
+
envValue: value,
|
|
103
|
+
templates: this.templates,
|
|
104
|
+
});
|
|
100
105
|
if (typeof value === 'undefined' && !optional) {
|
|
101
106
|
throw new Error(`Env parameter ${key} not found. You need add a this env parameter. If you have questions read the docs`);
|
|
102
107
|
}
|
|
103
108
|
// Not calling validation on empty values.
|
|
104
|
-
const validation = typeof
|
|
109
|
+
const validation = typeof interpolatedValue !== 'undefined' && validator(interpolatedValue);
|
|
105
110
|
if (typeof validation === 'string') {
|
|
106
111
|
throw new Error(`Env parameter ${key} with value ${value} not valid, message: ${validation}`);
|
|
107
112
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tramvai/module-environment",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.29.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"browser": "lib/browser.js",
|
|
6
6
|
"main": "lib/server.js",
|
|
@@ -19,11 +19,11 @@
|
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
21
|
"@tinkoff/utils": "^2.1.2",
|
|
22
|
-
"@tramvai/core": "4.
|
|
23
|
-
"@tramvai/papi": "4.
|
|
24
|
-
"@tramvai/state": "4.
|
|
25
|
-
"@tramvai/tokens-common": "4.
|
|
26
|
-
"@tramvai/tokens-server": "4.
|
|
22
|
+
"@tramvai/core": "4.29.1",
|
|
23
|
+
"@tramvai/papi": "4.29.1",
|
|
24
|
+
"@tramvai/state": "4.29.1",
|
|
25
|
+
"@tramvai/tokens-common": "4.29.1",
|
|
26
|
+
"@tramvai/tokens-server": "4.29.1",
|
|
27
27
|
"@tinkoff/dippy": "0.10.8",
|
|
28
28
|
"react": ">=16.14.0",
|
|
29
29
|
"react-dom": ">=16.14.0",
|