@candlerip/shared3 0.0.52 → 0.0.53
Sign up to get free protection for your applications and to get access to all the features.
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import { CustomError } from '../../../../error/index.js';
|
2
2
|
import { EnvironmentMode } from '../../../environment-mode/index.js';
|
3
3
|
import { EnvironmentVariables } from '../../../environment-variables/index.js';
|
4
|
-
export declare const loadEnvFile: <
|
4
|
+
export declare const loadEnvFile: <K extends keyof EnvironmentVariables = never, D = EnvironmentVariables[K]>(environmentMode: EnvironmentMode) => {
|
5
5
|
data: D;
|
6
6
|
} | {
|
7
7
|
customError: CustomError;
|
@@ -12,10 +12,12 @@ export const loadEnvFile = (environmentMode) => {
|
|
12
12
|
const data = {};
|
13
13
|
Object.keys(parsed).forEach((key) => {
|
14
14
|
if (ENVIRONMENT_VARIABLE[key] === 'boolean') {
|
15
|
-
|
15
|
+
data[key] = Boolean(parsed[key] === 'true');
|
16
|
+
return;
|
16
17
|
}
|
17
18
|
if (ENVIRONMENT_VARIABLE[key] === 'number') {
|
18
|
-
|
19
|
+
data[key] = parseInt(parsed[key]);
|
20
|
+
return;
|
19
21
|
}
|
20
22
|
data[key] = parsed[key];
|
21
23
|
});
|