@candlerip/shared3 0.0.26 → 0.0.27
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +1 -1
- package/src/environment/env-file/utils/load-env-file/types.d.ts +1 -1
- package/src/environment/environment-variables/index.d.ts +1 -0
- package/src/environment/environment-variables/index.js +1 -0
- package/src/environment/environment-variables/workers/environment-variables-worker/index.d.ts +2 -0
- package/src/environment/environment-variables/workers/environment-variables-worker/index.js +20 -0
- package/src/environment/environment-variables/workers/environment-variables-worker/types.d.ts +9 -0
- package/src/environment/environment-variables/workers/environment-variables-worker/types.js +1 -0
- package/src/environment/environment-variables/workers/index.d.ts +1 -0
- package/src/environment/environment-variables/workers/index.js +1 -0
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { CustomError } from '../../../../error/index.js';
|
2
2
|
import { EnvironmentMode } from '../../../environment-mode/index.js';
|
3
|
-
export type LoadEnvFile = <T extends Record<string, unknown
|
3
|
+
export type LoadEnvFile = <T extends Record<string, unknown>>(environmentMode: EnvironmentMode, options?: {
|
4
4
|
integers?: string[];
|
5
5
|
}) => {
|
6
6
|
data: T;
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import { loadEnvFile } from '../../../env-file/index.js';
|
2
|
+
export const EnvironmentVariablesWorker = (() => {
|
3
|
+
let envs;
|
4
|
+
const getEnvs = () => envs;
|
5
|
+
const init = () => {
|
6
|
+
const ENVIRONMENT_MODE = process.env.ENVIRONMENT_MODE;
|
7
|
+
const resp = loadEnvFile(ENVIRONMENT_MODE);
|
8
|
+
if ('customError' in resp) {
|
9
|
+
return resp;
|
10
|
+
}
|
11
|
+
envs = {
|
12
|
+
...resp.data,
|
13
|
+
ENVIRONMENT_MODE,
|
14
|
+
};
|
15
|
+
};
|
16
|
+
return {
|
17
|
+
getEnvs,
|
18
|
+
init,
|
19
|
+
};
|
20
|
+
})();
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './environment-variables-worker/index.js';
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './environment-variables-worker/index.js';
|