@@ -3,7 +3,7 @@ import * as path from 'path';
3
3
4
4
import * as pkg from '../package.json' ;
5
5
import {
6
- getOsEnv , getOsEnvOptional , getOsPath , getOsPaths , normalizePort , toBool , toNumber
6
+ getOsEnv , getOsEnvOptional , getOsPath , getOsPaths , normalizePort , toBool , toNumber ,
7
7
} from './lib/env' ;
8
8
9
9
/**
@@ -15,61 +15,66 @@ dotenv.config({ path: path.join(process.cwd(), `.env${((process.env.NODE_ENV ===
15
15
* Environment variables
16
16
*/
17
17
export const env = {
18
- node : process . env . NODE_ENV || 'development' ,
19
- isProduction : process . env . NODE_ENV === 'production' ,
20
- isTest : process . env . NODE_ENV === 'test' ,
21
- isDevelopment : process . env . NODE_ENV === 'development' ,
22
- app : {
23
- name : getOsEnv ( 'APP_NAME' ) ,
24
- version : ( pkg as any ) . version ,
25
- description : ( pkg as any ) . description ,
26
- host : getOsEnv ( 'APP_HOST' ) ,
27
- schema : getOsEnv ( 'APP_SCHEMA' ) ,
28
- routePrefix : getOsEnv ( 'APP_ROUTE_PREFIX' ) ,
29
- port : normalizePort ( process . env . PORT || getOsEnv ( 'APP_PORT' ) ) ,
30
- banner : toBool ( getOsEnv ( 'APP_BANNER' ) ) ,
31
- dirs : {
32
- migrations : getOsPaths ( 'TYPEORM_MIGRATIONS' ) ,
33
- migrationsDir : getOsPath ( 'TYPEORM_MIGRATIONS_DIR' ) ,
34
- entities : getOsPaths ( 'TYPEORM_ENTITIES' ) ,
35
- entitiesDir : getOsPath ( 'TYPEORM_ENTITIES_DIR' ) ,
36
- controllers : getOsPaths ( 'CONTROLLERS' ) ,
37
- middlewares : getOsPaths ( 'MIDDLEWARES' ) ,
38
- interceptors : getOsPaths ( 'INTERCEPTORS' ) ,
39
- subscribers : getOsPaths ( 'SUBSCRIBERS' ) ,
40
- resolvers : getOsPaths ( 'RESOLVERS' ) ,
41
- } ,
42
- } ,
43
- log : {
44
- level : getOsEnv ( 'LOG_LEVEL' ) ,
45
- json : toBool ( getOsEnvOptional ( 'LOG_JSON' ) ) ,
46
- output : getOsEnv ( 'LOG_OUTPUT' ) ,
47
- } ,
48
- db : {
49
- type : getOsEnv ( 'TYPEORM_CONNECTION' ) ,
50
- host : getOsEnvOptional ( 'TYPEORM_HOST' ) ,
51
- port : toNumber ( getOsEnvOptional ( 'TYPEORM_PORT' ) ) ,
52
- username : getOsEnvOptional ( 'TYPEORM_USERNAME' ) ,
53
- password : getOsEnvOptional ( 'TYPEORM_PASSWORD' ) ,
54
- database : getOsEnv ( 'TYPEORM_DATABASE' ) ,
55
- synchronize : toBool ( getOsEnvOptional ( 'TYPEORM_SYNCHRONIZE' ) ) ,
56
- logging : getOsEnv ( 'TYPEORM_LOGGING' ) ,
57
- } ,
58
- graphql : {
59
- enabled : toBool ( getOsEnv ( 'GRAPHQL_ENABLED' ) ) ,
60
- route : getOsEnv ( 'GRAPHQL_ROUTE' ) ,
61
- editor : toBool ( getOsEnv ( 'GRAPHQL_EDITOR' ) ) ,
62
- } ,
63
- swagger : {
64
- enabled : toBool ( getOsEnv ( 'SWAGGER_ENABLED' ) ) ,
65
- route : getOsEnv ( 'SWAGGER_ROUTE' ) ,
66
- username : getOsEnv ( 'SWAGGER_USERNAME' ) ,
67
- password : getOsEnv ( 'SWAGGER_PASSWORD' ) ,
68
- } ,
69
- monitor : {
70
- enabled : toBool ( getOsEnv ( 'MONITOR_ENABLED' ) ) ,
71
- route : getOsEnv ( 'MONITOR_ROUTE' ) ,
72
- username : getOsEnv ( 'MONITOR_USERNAME' ) ,
73
- password : getOsEnv ( 'MONITOR_PASSWORD' ) ,
18
+ node : process . env . NODE_ENV || 'development' ,
19
+ isProduction : process . env . NODE_ENV === 'production' ,
20
+ isTest : process . env . NODE_ENV === 'test' ,
21
+ isDevelopment : process . env . NODE_ENV === 'development' ,
22
+ app : {
23
+ name : getOsEnv ( 'APP_NAME' ) ,
24
+ version : ( pkg as any ) . version ,
25
+ description : ( pkg as any ) . description ,
26
+ host : getOsEnv ( 'APP_HOST' ) ,
27
+ schema : getOsEnv ( 'APP_SCHEMA' ) ,
28
+ routePrefix : getOsEnv ( 'APP_ROUTE_PREFIX' ) ,
29
+ port : normalizePort ( process . env . PORT || getOsEnv ( 'APP_PORT' ) ) ,
30
+ banner : toBool ( getOsEnv ( 'APP_BANNER' ) ) ,
31
+ dirs : {
32
+ migrations : getOsPaths ( 'TYPEORM_MIGRATIONS' ) ,
33
+ migrationsDir : getOsPath ( 'TYPEORM_MIGRATIONS_DIR' ) ,
34
+ entities : getOsPaths ( 'TYPEORM_ENTITIES' ) ,
35
+ entitiesDir : getOsPath ( 'TYPEORM_ENTITIES_DIR' ) ,
36
+ controllers : getOsPaths ( 'CONTROLLERS' ) ,
37
+ middlewares : getOsPaths ( 'MIDDLEWARES' ) ,
38
+ interceptors : getOsPaths ( 'INTERCEPTORS' ) ,
39
+ subscribers : getOsPaths ( 'SUBSCRIBERS' ) ,
40
+ resolvers : getOsPaths ( 'RESOLVERS' ) ,
74
41
} ,
42
+ } ,
43
+ aws : {
44
+ accessKeyId : getOsEnv ( 'AWS_ACCESS_KEY_ID' ) ,
45
+ secretAccessKey : getOsEnv ( 'AWS_SECRET_ACCESS_KEY' ) ,
46
+ region : getOsEnv ( 'AWS_REGION' ) ,
47
+ } ,
48
+ log : {
49
+ level : getOsEnv ( 'LOG_LEVEL' ) ,
50
+ json : toBool ( getOsEnvOptional ( 'LOG_JSON' ) ) ,
51
+ output : getOsEnv ( 'LOG_OUTPUT' ) ,
52
+ } ,
53
+ db : {
54
+ type : getOsEnv ( 'TYPEORM_CONNECTION' ) ,
55
+ host : getOsEnvOptional ( 'TYPEORM_HOST' ) ,
56
+ port : toNumber ( getOsEnvOptional ( 'TYPEORM_PORT' ) ) ,
57
+ username : getOsEnvOptional ( 'TYPEORM_USERNAME' ) ,
58
+ password : getOsEnvOptional ( 'TYPEORM_PASSWORD' ) ,
59
+ database : getOsEnv ( 'TYPEORM_DATABASE' ) ,
60
+ synchronize : toBool ( getOsEnvOptional ( 'TYPEORM_SYNCHRONIZE' ) ) ,
61
+ logging : getOsEnv ( 'TYPEORM_LOGGING' ) ,
62
+ } ,
63
+ graphql : {
64
+ enabled : toBool ( getOsEnv ( 'GRAPHQL_ENABLED' ) ) ,
65
+ route : getOsEnv ( 'GRAPHQL_ROUTE' ) ,
66
+ editor : toBool ( getOsEnv ( 'GRAPHQL_EDITOR' ) ) ,
67
+ } ,
68
+ swagger : {
69
+ enabled : toBool ( getOsEnv ( 'SWAGGER_ENABLED' ) ) ,
70
+ route : getOsEnv ( 'SWAGGER_ROUTE' ) ,
71
+ username : getOsEnv ( 'SWAGGER_USERNAME' ) ,
72
+ password : getOsEnv ( 'SWAGGER_PASSWORD' ) ,
73
+ } ,
74
+ monitor : {
75
+ enabled : toBool ( getOsEnv ( 'MONITOR_ENABLED' ) ) ,
76
+ route : getOsEnv ( 'MONITOR_ROUTE' ) ,
77
+ username : getOsEnv ( 'MONITOR_USERNAME' ) ,
78
+ password : getOsEnv ( 'MONITOR_PASSWORD' ) ,
79
+ } ,
75
80
} ;
0 commit comments