@nest-omni/core 1.0.19 → 1.0.21
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
package/setup/bootstrap.setup.js
CHANGED
|
@@ -97,7 +97,7 @@ function bootstrapSetup(AppModule, SetupSwagger) {
|
|
|
97
97
|
SetupSwagger(app, configService.documentationPath);
|
|
98
98
|
}
|
|
99
99
|
if (configService.viewsEnabled) {
|
|
100
|
-
app.setBaseViewsDir((0, path_1.join)(
|
|
100
|
+
app.setBaseViewsDir((0, path_1.join)(__1.ApiConfigService.rootPath, 'views'));
|
|
101
101
|
app.setViewEngine('ejs');
|
|
102
102
|
}
|
|
103
103
|
if (configService.sessionEnabled) {
|
|
@@ -38,12 +38,19 @@ const providers = [
|
|
|
38
38
|
services_1.GeneratorService,
|
|
39
39
|
services_1.TranslationService,
|
|
40
40
|
];
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
function findValidRootPath() {
|
|
42
|
+
const possibleRootPaths = [process.cwd(), __dirname];
|
|
43
|
+
const envFile = `${process.env.NODE_ENV || ''}.env`;
|
|
44
|
+
for (const rootPath of possibleRootPaths) {
|
|
45
|
+
const envFilePath = path.join(rootPath, 'config', envFile);
|
|
46
|
+
if ((0, fs_1.existsSync)(envFilePath)) {
|
|
47
|
+
return { rootPath, envFilePath };
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
throw new Error('No valid .env file found in any root path');
|
|
46
51
|
}
|
|
52
|
+
const { envFilePath, rootPath } = findValidRootPath();
|
|
53
|
+
services_1.ApiConfigService.rootPath = rootPath;
|
|
47
54
|
const modules = [
|
|
48
55
|
config_1.ConfigModule.forRoot({
|
|
49
56
|
isGlobal: true,
|
|
@@ -65,7 +72,7 @@ const modules = [
|
|
|
65
72
|
useFactory: (config) => ({
|
|
66
73
|
fallbackLanguage: config.fallbackLanguage,
|
|
67
74
|
loaderOptions: {
|
|
68
|
-
path: path.join(
|
|
75
|
+
path: path.join(services_1.ApiConfigService.rootPath, '/i18n/'),
|
|
69
76
|
watch: config.isDev,
|
|
70
77
|
},
|
|
71
78
|
logging: config.isDev,
|