@nest-omni/core 1.0.45 → 1.0.47

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.45",
3
+ "version": "1.0.47",
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.3.2",
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 = path.join(rootPath, 'config');
46
- const baseEnvFilePath = path.join(configPath, 'base.env');
47
- const envFilePath = path.join(configPath, envFile);
48
- if ((0, fs_1.existsSync)(envFilePath)) {
49
- return { rootPath, baseEnvFilePath, envFilePath };
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,6 @@ let ApiConfigService = ApiConfigService_1 = class ApiConfigService {
104
104
  return {
105
105
  autoLoadEntities: true,
106
106
  keepConnectionAlive: !this.isDev,
107
- dropSchema: this.isTest,
108
107
  type: 'mysql',
109
108
  host: this.getString('DB_HOST'),
110
109
  port: this.getNumber('DB_PORT'),