11import * as path from 'path' ;
2- import * as pkg from '../../package.json' ;
32import * as dotenv from 'dotenv' ;
4- dotenv . config ( ) ;
3+ import * as pkg from '../../package.json' ;
54
5+ /**
6+ * Load .env file or for tests the .env.test file.
7+ */
8+ dotenv . config ( { path : path . join ( process . cwd ( ) , `.env${ ( ( process . env . NODE_ENV === 'test' ) ? '.test' : '' ) } ` ) } ) ;
69
710/**
811 * Environment variables
@@ -22,7 +25,7 @@ export const env = {
2225 migrations : [ path . join ( __dirname , '..' , 'database/migrations/*.ts' ) ] ,
2326 migrationsDir : path . join ( __dirname , '..' , 'database/migrations' ) ,
2427 entities : [ path . join ( __dirname , '..' , 'api/**/models/*{.js,.ts}' ) ] ,
25- subscribers : [ path . join ( __dirname , '..' , 'api/**/*Subscriber{.js,.ts}' ) ] ,
28+ subscribers : [ path . join ( __dirname , '..' , 'api/**/*Subscriber{.js,.ts}' ) ] ,
2629 controllers : [ path . join ( __dirname , '..' , 'api/**/*Controller{.js,.ts}' ) ] ,
2730 middlewares : [ path . join ( __dirname , '..' , 'api/**/*Middleware{.js,.ts}' ) ] ,
2831 interceptors : [ path . join ( __dirname , '..' , 'api/**/*Interceptor{.js,.ts}' ) ] ,
0 commit comments