@@ -2,7 +2,7 @@ import * as dotenv from 'dotenv';
22import * as path from 'path' ;
33
44import * as pkg from '../package.json' ;
5- import { getOsEnv , normalizePort , toBool , toNumber } from './lib/env' ;
5+ import { getOsEnv , getOsEnvArray , normalizePort , toBool , toNumber } from './lib/env' ;
66
77/**
88 * Load .env file or for tests the .env.test file.
@@ -27,15 +27,15 @@ export const env = {
2727 port : normalizePort ( process . env . PORT || getOsEnv ( 'APP_PORT' ) ) ,
2828 banner : toBool ( getOsEnv ( 'APP_BANNER' ) ) ,
2929 dirs : {
30- migrations : [ path . relative ( path . join ( process . cwd ( ) ) , path . join ( __dirname , 'database/migrations/**/*.ts' ) ) ] ,
31- migrationsDir : path . relative ( path . join ( process . cwd ( ) ) , path . join ( __dirname , 'database/migrations' ) ) ,
32- entities : [ path . relative ( path . join ( process . cwd ( ) ) , path . join ( __dirname , 'api/models/**/*{.js,.ts}' ) ) ] ,
33- subscribers : [ path . join ( __dirname , 'api/subscribers/**/*Subscriber{.js,.ts}' ) ] ,
34- controllers : [ path . join ( __dirname , 'api/controllers/**/*Controller{.js,.ts}' ) ] ,
35- middlewares : [ path . join ( __dirname , 'api/middlewares/**/*Middleware{.js,.ts}' ) ] ,
36- interceptors : [ path . join ( __dirname , 'api/interceptors/**/*Interceptor{.js,.ts}' ) ] ,
37- queries : [ path . join ( __dirname , 'api/queries/**/*Query{.js,.ts}' ) ] ,
38- mutations : [ path . join ( __dirname , 'api/mutations/**/*Mutation{.js,.ts}' ) ] ,
30+ migrations : getOsEnvArray ( 'TYPEORM_MIGRATIONS' ) || [ path . relative ( path . join ( process . cwd ( ) ) , path . join ( __dirname , 'database/migrations/**/*.ts' ) ) ] ,
31+ migrationsDir : getOsEnv ( 'TYPEORM_MIGRATIONS_DIR' ) || path . relative ( path . join ( process . cwd ( ) ) , path . join ( __dirname , 'database/migrations' ) ) ,
32+ entities : getOsEnvArray ( 'TYPEORM_ENTITIES' ) || [ path . relative ( path . join ( process . cwd ( ) ) , path . join ( __dirname , 'api/models/**/*{.js,.ts}' ) ) ] ,
33+ subscribers : getOsEnvArray ( 'TYPEORM_SUBSCRIBERS' ) || [ path . join ( __dirname , 'api/subscribers/**/*Subscriber{.js,.ts}' ) ] ,
34+ controllers : getOsEnvArray ( 'CONTROLLERS' ) || [ path . join ( __dirname , 'api/controllers/**/*Controller{.js,.ts}' ) ] ,
35+ middlewares : getOsEnvArray ( 'MIDDLEWARES' ) || [ path . join ( __dirname , 'api/middlewares/**/*Middleware{.js,.ts}' ) ] ,
36+ interceptors : getOsEnvArray ( 'INTERCEPTORS' ) || [ path . join ( __dirname , 'api/interceptors/**/*Interceptor{.js,.ts}' ) ] ,
37+ queries : getOsEnvArray ( 'QUERIES' ) || [ path . join ( __dirname , 'api/queries/**/*Query{.js,.ts}' ) ] ,
38+ mutations : getOsEnvArray ( 'MUTATIONS' ) || [ path . join ( __dirname , 'api/mutations/**/*Mutation{.js,.ts}' ) ] ,
3939 } ,
4040 } ,
4141 log : {
@@ -47,14 +47,14 @@ export const env = {
4747 route : getOsEnv ( 'AUTH_ROUTE' ) ,
4848 } ,
4949 db : {
50- type : getOsEnv ( 'DB_TYPE ' ) ,
51- host : getOsEnv ( 'DB_HOST ' ) ,
52- port : toNumber ( getOsEnv ( 'DB_PORT ' ) ) ,
53- username : getOsEnv ( 'DB_USERNAME ' ) ,
54- password : getOsEnv ( 'DB_PASSWORD ' ) ,
55- database : getOsEnv ( 'DB_DATABASE ' ) ,
56- synchronize : toBool ( getOsEnv ( 'DB_SYNCHRONIZE ' ) ) ,
57- logging : toBool ( getOsEnv ( 'DB_LOGGING ' ) ) ,
50+ type : getOsEnv ( 'TYPEORM_CONNECTION ' ) ,
51+ host : getOsEnv ( 'TYPEORM_HOST ' ) ,
52+ port : toNumber ( getOsEnv ( 'TYPEORM_PORT ' ) ) ,
53+ username : getOsEnv ( 'TYPEORM_USERNAME ' ) ,
54+ password : getOsEnv ( 'TYPEORM_PASSWORD ' ) ,
55+ database : getOsEnv ( 'TYPEORM_DATABASE ' ) ,
56+ synchronize : toBool ( getOsEnv ( 'TYPEORM_SYNCHRONIZE ' ) ) ,
57+ logging : toBool ( getOsEnv ( 'TYPEORM_LOGGING ' ) ) ,
5858 } ,
5959 graphql : {
6060 enabled : toBool ( getOsEnv ( 'GRAPHQL_ENABLED' ) ) ,
0 commit comments