@nest-omni/core 1.0.45 → 1.0.46
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nest-omni/core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.46",
|
|
4
4
|
"description": "framework",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"moment": "^2.29.4",
|
|
53
53
|
"mysql2": "^3.6.1",
|
|
54
54
|
"nestjs-cls": "^4.3.0",
|
|
55
|
-
"nestjs-i18n": "^10.
|
|
55
|
+
"nestjs-i18n": "^10.5.0",
|
|
56
56
|
"nestjs-pino": "^3.4.0",
|
|
57
57
|
"pino-http": "^8.5.0",
|
|
58
58
|
"pino-pretty": "^10.2.0",
|
|
@@ -32,21 +32,38 @@ const nestjs_i18n_1 = require("nestjs-i18n");
|
|
|
32
32
|
const health_checker_module_1 = require("../health-checker/health-checker.module");
|
|
33
33
|
const services_1 = require("./services");
|
|
34
34
|
const fs_1 = require("fs");
|
|
35
|
+
const path_1 = require("path");
|
|
35
36
|
const providers = [
|
|
36
37
|
services_1.ApiConfigService,
|
|
37
38
|
services_1.ValidatorService,
|
|
38
39
|
services_1.GeneratorService,
|
|
39
40
|
services_1.TranslationService,
|
|
40
41
|
];
|
|
42
|
+
const isTest = process.env.NODE_ENV === 'test';
|
|
41
43
|
function findValidRootPath() {
|
|
42
44
|
const possibleRootPaths = [process.cwd(), __dirname];
|
|
43
45
|
const envFile = `${process.env.NODE_ENV || ''}.env`;
|
|
46
|
+
let envFilePath = '';
|
|
44
47
|
for (const rootPath of possibleRootPaths) {
|
|
45
|
-
const configPath =
|
|
46
|
-
const baseEnvFilePath =
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
const configPath = (0, path_1.join)(rootPath, 'config');
|
|
49
|
+
const baseEnvFilePath = (0, path_1.join)(configPath, 'base.env');
|
|
50
|
+
if (isTest) {
|
|
51
|
+
envFilePath = (0, path_1.join)(configPath, 'test.env');
|
|
52
|
+
if ((0, fs_1.existsSync)(envFilePath)) {
|
|
53
|
+
return { rootPath, baseEnvFilePath, envFilePath };
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
envFilePath = (0, path_1.join)(configPath, 'dev.env');
|
|
57
|
+
if ((0, fs_1.existsSync)(envFilePath)) {
|
|
58
|
+
return { rootPath, baseEnvFilePath, envFilePath };
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
envFilePath = (0, path_1.join)(configPath, envFile);
|
|
64
|
+
if ((0, fs_1.existsSync)(envFilePath)) {
|
|
65
|
+
return { rootPath, baseEnvFilePath, envFilePath };
|
|
66
|
+
}
|
|
50
67
|
}
|
|
51
68
|
}
|
|
52
69
|
throw new Error(`No valid .env file: ${envFilePath}`);
|
|
@@ -104,7 +104,7 @@ let ApiConfigService = ApiConfigService_1 = class ApiConfigService {
|
|
|
104
104
|
return {
|
|
105
105
|
autoLoadEntities: true,
|
|
106
106
|
keepConnectionAlive: !this.isDev,
|
|
107
|
-
dropSchema: this.isTest,
|
|
107
|
+
dropSchema: this.isTest ? this.getBoolean('DB_DROP_SCHEMA') : false,
|
|
108
108
|
type: 'mysql',
|
|
109
109
|
host: this.getString('DB_HOST'),
|
|
110
110
|
port: this.getNumber('DB_PORT'),
|