opticore-env-access 1.0.4 → 1.0.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/dist/index.cjs +39 -38
- package/dist/index.d.cts +2 -10
- package/dist/index.d.ts +2 -10
- package/dist/index.js +38 -36
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -30,8 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
|
-
|
|
34
|
-
getEnvVariable: () => getEnvVariable
|
|
33
|
+
getEnvironnementValue: () => getEnvironnementValue
|
|
35
34
|
});
|
|
36
35
|
module.exports = __toCommonJS(index_exports);
|
|
37
36
|
|
|
@@ -39,42 +38,10 @@ module.exports = __toCommonJS(index_exports);
|
|
|
39
38
|
var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
|
|
40
39
|
var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
41
40
|
|
|
42
|
-
// src/domains/environnement/access.env.ts
|
|
43
|
-
var import_dotenv = __toESM(require("dotenv"), 1);
|
|
44
|
-
var getEnvVariable = {
|
|
45
|
-
apiVersion: String(import_dotenv.default.config()?.parsed?.API_VERSION),
|
|
46
|
-
appHost: String(import_dotenv.default.config()?.parsed?.APP_HOST),
|
|
47
|
-
appPort: String(import_dotenv.default.config()?.parsed?.APP_PORT),
|
|
48
|
-
argumentsDatabaseConnection: String(import_dotenv.default.config()?.parsed?.ARGUMENTS_DATABASE_CONNECTION),
|
|
49
|
-
devEnv: String(import_dotenv.default.config()?.parsed?.ENV_DEV),
|
|
50
|
-
dataBaseHost: String(import_dotenv.default.config()?.parsed?.DATA_BASE_HOST),
|
|
51
|
-
dataBasePort: String(import_dotenv.default.config()?.parsed?.DATA_BASE_PORT),
|
|
52
|
-
dataBaseUser: String(import_dotenv.default.config()?.parsed?.DATA_BASE_USER),
|
|
53
|
-
dataBasePassword: String(import_dotenv.default.config()?.parsed?.DATA_BASE_PASSWORD),
|
|
54
|
-
dataBaseName: String(import_dotenv.default.config()?.parsed?.DATA_BASE_NAME),
|
|
55
|
-
defaultLocal: String(import_dotenv.default.config()?.parsed?.DEFAULT_LOCAL_LANG),
|
|
56
|
-
protocolTransfert: String(import_dotenv.default.config()?.parsed?.PROTOCOL_TRANSFERT),
|
|
57
|
-
logEnv: String(import_dotenv.default.config()?.parsed?.LOG_ENVIRONMENT),
|
|
58
|
-
logFileMaxSize: Number(import_dotenv.default.config()?.parsed?.LOG_ENVIRONMENT_FILE_MAX_SIZE),
|
|
59
|
-
logFileRotate: Boolean(import_dotenv.default.config()?.parsed?.LOG_ENVIRONMENT_FILE_ROTATE),
|
|
60
|
-
logFileEnabled: Boolean(import_dotenv.default.config()?.parsed?.LOG_ENVIRONMENT_FILE_ENABLED),
|
|
61
|
-
logRemoteEndPoint: String(import_dotenv.default.config()?.parsed?.LOG_ENVIRONMENT_REMOTE_ENDPOINT),
|
|
62
|
-
logRemoteEnabled: Boolean(import_dotenv.default.config()?.parsed?.LOG_ENVIRONMENT_REMOTE_ENABLED),
|
|
63
|
-
logConsoleEnabled: Boolean(import_dotenv.default.config()?.parsed?.LOG_ENVIRONMENT_CONSOLE_ENABLED),
|
|
64
|
-
logLevelError: String(import_dotenv.default.config()?.parsed?.LOG_ENVIRONMENT_LOG_LEVEL_ERROR),
|
|
65
|
-
logLevelInfo: String(import_dotenv.default.config()?.parsed?.LOG_ENVIRONMENT_LOG_LEVEL_INFO),
|
|
66
|
-
logLevelSuccess: String(import_dotenv.default.config()?.parsed?.LOG_ENVIRONMENT_LOG_LEVEL_SUCCESS),
|
|
67
|
-
logLevelWarning: String(import_dotenv.default.config()?.parsed?.LOG_ENVIRONMENT_LOG_LEVEL_WARN),
|
|
68
|
-
logLevelDebug: String(import_dotenv.default.config()?.parsed?.LOG_ENVIRONMENT_LOG_LEVEL_DEBUG),
|
|
69
|
-
passwordField: String(import_dotenv.default.config()?.parsed?.PASSWORD_FIELD),
|
|
70
|
-
prodEnv: String(import_dotenv.default.config()?.parsed?.ENV_PROD),
|
|
71
|
-
usernameField: String(import_dotenv.default.config()?.parsed?.USERNAME_FIELD)
|
|
72
|
-
};
|
|
73
|
-
|
|
74
41
|
// src/config/envPath.config.ts
|
|
75
42
|
var import_path = __toESM(require("path"), 1);
|
|
76
|
-
var import_dotenv2 = __toESM(require("dotenv"), 1);
|
|
77
43
|
var fs = __toESM(require("fs"), 1);
|
|
44
|
+
var import_dotenv = __toESM(require("dotenv"), 1);
|
|
78
45
|
var import_url = require("url");
|
|
79
46
|
var import_opticore_logger = require("opticore-logger");
|
|
80
47
|
var import_opticore_http_response = require("opticore-http-response");
|
|
@@ -102,10 +69,44 @@ var envPathConfig = (envDirPath) => {
|
|
|
102
69
|
import_opticore_http_response.HttpStatusCode.NOT_FOUND
|
|
103
70
|
);
|
|
104
71
|
}
|
|
105
|
-
|
|
72
|
+
return import_dotenv.default.config({ path: envPath });
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
// src/domains/environnement/access.env.ts
|
|
76
|
+
var getEnvironnementValue = (envDir) => {
|
|
77
|
+
const envPath = envPathConfig(envDir);
|
|
78
|
+
const getEnvVariable = {
|
|
79
|
+
apiVersion: String(envPath.parsed?.API_VERSION),
|
|
80
|
+
appHost: String(envPath.parsed?.APP_HOST),
|
|
81
|
+
appPort: String(envPath.parsed?.APP_PORT),
|
|
82
|
+
argumentsDatabaseConnection: String(envPath.parsed?.ARGUMENTS_DATABASE_CONNECTION),
|
|
83
|
+
devEnv: String(envPath.parsed?.ENV_DEV),
|
|
84
|
+
dataBaseHost: String(envPath.parsed?.DATA_BASE_HOST),
|
|
85
|
+
dataBasePort: String(envPath.parsed?.DATA_BASE_PORT),
|
|
86
|
+
dataBaseUser: String(envPath.parsed?.DATA_BASE_USER),
|
|
87
|
+
dataBasePassword: String(envPath.parsed?.DATA_BASE_PASSWORD),
|
|
88
|
+
dataBaseName: String(envPath.parsed?.DATA_BASE_NAME),
|
|
89
|
+
defaultLocal: String(envPath.parsed?.DEFAULT_LOCAL_LANG),
|
|
90
|
+
protocolTransfert: String(envPath.parsed?.PROTOCOL_TRANSFERT),
|
|
91
|
+
logEnv: String(envPath.parsed?.LOG_ENVIRONMENT),
|
|
92
|
+
logFileMaxSize: Number(envPath.parsed?.LOG_ENVIRONMENT_FILE_MAX_SIZE),
|
|
93
|
+
logFileRotate: Boolean(envPath.parsed?.LOG_ENVIRONMENT_FILE_ROTATE),
|
|
94
|
+
logFileEnabled: Boolean(envPath.parsed?.LOG_ENVIRONMENT_FILE_ENABLED),
|
|
95
|
+
logRemoteEndPoint: String(envPath.parsed?.LOG_ENVIRONMENT_REMOTE_ENDPOINT),
|
|
96
|
+
logRemoteEnabled: Boolean(envPath.parsed?.LOG_ENVIRONMENT_REMOTE_ENABLED),
|
|
97
|
+
logConsoleEnabled: Boolean(envPath.parsed?.LOG_ENVIRONMENT_CONSOLE_ENABLED),
|
|
98
|
+
logLevelError: String(envPath.parsed?.LOG_ENVIRONMENT_LOG_LEVEL_ERROR),
|
|
99
|
+
logLevelInfo: String(envPath.parsed?.LOG_ENVIRONMENT_LOG_LEVEL_INFO),
|
|
100
|
+
logLevelSuccess: String(envPath.parsed?.LOG_ENVIRONMENT_LOG_LEVEL_SUCCESS),
|
|
101
|
+
logLevelWarning: String(envPath.parsed?.LOG_ENVIRONMENT_LOG_LEVEL_WARN),
|
|
102
|
+
logLevelDebug: String(envPath.parsed?.LOG_ENVIRONMENT_LOG_LEVEL_DEBUG),
|
|
103
|
+
passwordField: String(envPath.parsed?.PASSWORD_FIELD),
|
|
104
|
+
prodEnv: String(envPath.parsed?.ENV_PROD),
|
|
105
|
+
usernameField: String(envPath.parsed?.USERNAME_FIELD)
|
|
106
|
+
};
|
|
107
|
+
return getEnvVariable;
|
|
106
108
|
};
|
|
107
109
|
// Annotate the CommonJS export names for ESM import in node:
|
|
108
110
|
0 && (module.exports = {
|
|
109
|
-
|
|
110
|
-
getEnvVariable
|
|
111
|
+
getEnvironnementValue
|
|
111
112
|
});
|
package/dist/index.d.cts
CHANGED
|
@@ -28,14 +28,6 @@ interface IEnvVariables {
|
|
|
28
28
|
protocolTransfert: string;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
declare const
|
|
31
|
+
declare const getEnvironnementValue: (envDir: string) => IEnvVariables;
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
* Load environment variables from an .env file located in a specific folder.
|
|
35
|
-
* @param envDirPath - Relative or absolute path to the folder containing the .env file.
|
|
36
|
-
*
|
|
37
|
-
* @throws Error if the .env file does not exist or cannot be read.
|
|
38
|
-
*/
|
|
39
|
-
declare const envPathConfig: (envDirPath: string) => void;
|
|
40
|
-
|
|
41
|
-
export { type IEnvVariables, envPathConfig, getEnvVariable };
|
|
33
|
+
export { type IEnvVariables, getEnvironnementValue };
|
package/dist/index.d.ts
CHANGED
|
@@ -28,14 +28,6 @@ interface IEnvVariables {
|
|
|
28
28
|
protocolTransfert: string;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
declare const
|
|
31
|
+
declare const getEnvironnementValue: (envDir: string) => IEnvVariables;
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
* Load environment variables from an .env file located in a specific folder.
|
|
35
|
-
* @param envDirPath - Relative or absolute path to the folder containing the .env file.
|
|
36
|
-
*
|
|
37
|
-
* @throws Error if the .env file does not exist or cannot be read.
|
|
38
|
-
*/
|
|
39
|
-
declare const envPathConfig: (envDirPath: string) => void;
|
|
40
|
-
|
|
41
|
-
export { type IEnvVariables, envPathConfig, getEnvVariable };
|
|
33
|
+
export { type IEnvVariables, getEnvironnementValue };
|
package/dist/index.js
CHANGED
|
@@ -1,39 +1,7 @@
|
|
|
1
|
-
// src/domains/environnement/access.env.ts
|
|
2
|
-
import dotenv from "dotenv";
|
|
3
|
-
var getEnvVariable = {
|
|
4
|
-
apiVersion: String(dotenv.config()?.parsed?.API_VERSION),
|
|
5
|
-
appHost: String(dotenv.config()?.parsed?.APP_HOST),
|
|
6
|
-
appPort: String(dotenv.config()?.parsed?.APP_PORT),
|
|
7
|
-
argumentsDatabaseConnection: String(dotenv.config()?.parsed?.ARGUMENTS_DATABASE_CONNECTION),
|
|
8
|
-
devEnv: String(dotenv.config()?.parsed?.ENV_DEV),
|
|
9
|
-
dataBaseHost: String(dotenv.config()?.parsed?.DATA_BASE_HOST),
|
|
10
|
-
dataBasePort: String(dotenv.config()?.parsed?.DATA_BASE_PORT),
|
|
11
|
-
dataBaseUser: String(dotenv.config()?.parsed?.DATA_BASE_USER),
|
|
12
|
-
dataBasePassword: String(dotenv.config()?.parsed?.DATA_BASE_PASSWORD),
|
|
13
|
-
dataBaseName: String(dotenv.config()?.parsed?.DATA_BASE_NAME),
|
|
14
|
-
defaultLocal: String(dotenv.config()?.parsed?.DEFAULT_LOCAL_LANG),
|
|
15
|
-
protocolTransfert: String(dotenv.config()?.parsed?.PROTOCOL_TRANSFERT),
|
|
16
|
-
logEnv: String(dotenv.config()?.parsed?.LOG_ENVIRONMENT),
|
|
17
|
-
logFileMaxSize: Number(dotenv.config()?.parsed?.LOG_ENVIRONMENT_FILE_MAX_SIZE),
|
|
18
|
-
logFileRotate: Boolean(dotenv.config()?.parsed?.LOG_ENVIRONMENT_FILE_ROTATE),
|
|
19
|
-
logFileEnabled: Boolean(dotenv.config()?.parsed?.LOG_ENVIRONMENT_FILE_ENABLED),
|
|
20
|
-
logRemoteEndPoint: String(dotenv.config()?.parsed?.LOG_ENVIRONMENT_REMOTE_ENDPOINT),
|
|
21
|
-
logRemoteEnabled: Boolean(dotenv.config()?.parsed?.LOG_ENVIRONMENT_REMOTE_ENABLED),
|
|
22
|
-
logConsoleEnabled: Boolean(dotenv.config()?.parsed?.LOG_ENVIRONMENT_CONSOLE_ENABLED),
|
|
23
|
-
logLevelError: String(dotenv.config()?.parsed?.LOG_ENVIRONMENT_LOG_LEVEL_ERROR),
|
|
24
|
-
logLevelInfo: String(dotenv.config()?.parsed?.LOG_ENVIRONMENT_LOG_LEVEL_INFO),
|
|
25
|
-
logLevelSuccess: String(dotenv.config()?.parsed?.LOG_ENVIRONMENT_LOG_LEVEL_SUCCESS),
|
|
26
|
-
logLevelWarning: String(dotenv.config()?.parsed?.LOG_ENVIRONMENT_LOG_LEVEL_WARN),
|
|
27
|
-
logLevelDebug: String(dotenv.config()?.parsed?.LOG_ENVIRONMENT_LOG_LEVEL_DEBUG),
|
|
28
|
-
passwordField: String(dotenv.config()?.parsed?.PASSWORD_FIELD),
|
|
29
|
-
prodEnv: String(dotenv.config()?.parsed?.ENV_PROD),
|
|
30
|
-
usernameField: String(dotenv.config()?.parsed?.USERNAME_FIELD)
|
|
31
|
-
};
|
|
32
|
-
|
|
33
1
|
// src/config/envPath.config.ts
|
|
34
2
|
import path from "path";
|
|
35
|
-
import dotenv2 from "dotenv";
|
|
36
3
|
import * as fs from "fs";
|
|
4
|
+
import dotenv from "dotenv";
|
|
37
5
|
import { fileURLToPath } from "url";
|
|
38
6
|
import { LoggerCore } from "opticore-logger";
|
|
39
7
|
import { HttpStatusCode } from "opticore-http-response";
|
|
@@ -61,9 +29,43 @@ var envPathConfig = (envDirPath) => {
|
|
|
61
29
|
HttpStatusCode.NOT_FOUND
|
|
62
30
|
);
|
|
63
31
|
}
|
|
64
|
-
|
|
32
|
+
return dotenv.config({ path: envPath });
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
// src/domains/environnement/access.env.ts
|
|
36
|
+
var getEnvironnementValue = (envDir) => {
|
|
37
|
+
const envPath = envPathConfig(envDir);
|
|
38
|
+
const getEnvVariable = {
|
|
39
|
+
apiVersion: String(envPath.parsed?.API_VERSION),
|
|
40
|
+
appHost: String(envPath.parsed?.APP_HOST),
|
|
41
|
+
appPort: String(envPath.parsed?.APP_PORT),
|
|
42
|
+
argumentsDatabaseConnection: String(envPath.parsed?.ARGUMENTS_DATABASE_CONNECTION),
|
|
43
|
+
devEnv: String(envPath.parsed?.ENV_DEV),
|
|
44
|
+
dataBaseHost: String(envPath.parsed?.DATA_BASE_HOST),
|
|
45
|
+
dataBasePort: String(envPath.parsed?.DATA_BASE_PORT),
|
|
46
|
+
dataBaseUser: String(envPath.parsed?.DATA_BASE_USER),
|
|
47
|
+
dataBasePassword: String(envPath.parsed?.DATA_BASE_PASSWORD),
|
|
48
|
+
dataBaseName: String(envPath.parsed?.DATA_BASE_NAME),
|
|
49
|
+
defaultLocal: String(envPath.parsed?.DEFAULT_LOCAL_LANG),
|
|
50
|
+
protocolTransfert: String(envPath.parsed?.PROTOCOL_TRANSFERT),
|
|
51
|
+
logEnv: String(envPath.parsed?.LOG_ENVIRONMENT),
|
|
52
|
+
logFileMaxSize: Number(envPath.parsed?.LOG_ENVIRONMENT_FILE_MAX_SIZE),
|
|
53
|
+
logFileRotate: Boolean(envPath.parsed?.LOG_ENVIRONMENT_FILE_ROTATE),
|
|
54
|
+
logFileEnabled: Boolean(envPath.parsed?.LOG_ENVIRONMENT_FILE_ENABLED),
|
|
55
|
+
logRemoteEndPoint: String(envPath.parsed?.LOG_ENVIRONMENT_REMOTE_ENDPOINT),
|
|
56
|
+
logRemoteEnabled: Boolean(envPath.parsed?.LOG_ENVIRONMENT_REMOTE_ENABLED),
|
|
57
|
+
logConsoleEnabled: Boolean(envPath.parsed?.LOG_ENVIRONMENT_CONSOLE_ENABLED),
|
|
58
|
+
logLevelError: String(envPath.parsed?.LOG_ENVIRONMENT_LOG_LEVEL_ERROR),
|
|
59
|
+
logLevelInfo: String(envPath.parsed?.LOG_ENVIRONMENT_LOG_LEVEL_INFO),
|
|
60
|
+
logLevelSuccess: String(envPath.parsed?.LOG_ENVIRONMENT_LOG_LEVEL_SUCCESS),
|
|
61
|
+
logLevelWarning: String(envPath.parsed?.LOG_ENVIRONMENT_LOG_LEVEL_WARN),
|
|
62
|
+
logLevelDebug: String(envPath.parsed?.LOG_ENVIRONMENT_LOG_LEVEL_DEBUG),
|
|
63
|
+
passwordField: String(envPath.parsed?.PASSWORD_FIELD),
|
|
64
|
+
prodEnv: String(envPath.parsed?.ENV_PROD),
|
|
65
|
+
usernameField: String(envPath.parsed?.USERNAME_FIELD)
|
|
66
|
+
};
|
|
67
|
+
return getEnvVariable;
|
|
65
68
|
};
|
|
66
69
|
export {
|
|
67
|
-
|
|
68
|
-
getEnvVariable
|
|
70
|
+
getEnvironnementValue
|
|
69
71
|
};
|