1- import { Config } from "./Config" ;
2- require ( 'dotenv' ) . config ( )
3-
4- export const CONFIG : Config = {
5- appPort : parseInt ( process . env . PORT || "8080" ) ,
6-
7- databaseHost : process . env . DATABASE_HOST || "localhost" ,
8- databasePort : parseInt ( process . env . DATABASE_PORT || "5432" ) ,
9- databaseName : process . env . DATABASE_NAME || "postgres" ,
10- databaseUser : process . env . DATABASE_USER || "postgres" ,
11- databasePassword : process . env . DATABASE_PASSWORD || "postgres" ,
12-
13- get databaseConnectionString ( ) : string {
14- return `postgres://${ this . databaseUser } :${ this . databasePassword } @${ this . databaseHost } :${ this . databasePort } /${ this . databaseName } `
15- } ,
16-
17- redisConnectionString : process . env . REDIS_CONNECTION_STRING || "redis://127.0.0.1:6379/0" ,
18-
19- jwtSecret : process . env . JWT_SECRET || "SECRET" ,
20- jwtExpiration : process . env . JWT_EXPIRATION || "24h" ,
21-
22- log : function ( ) : void {
23- console . log ( `[INFO] Webapp loaded with config:\nPORT: ${ this . appPort } \nDATABASE CONNECTION: ${ this . databaseConnectionString } \nJWT SECRET: ${ this . jwtSecret } \nJWT EXPIRATION: ${ this . jwtExpiration } \n` )
24- }
1+ import { Config } from "./Config" ;
2+ require ( 'dotenv' ) . config ( )
3+
4+ export const CONFIG : Config = {
5+ appPort : parseInt ( process . env . PORT || "8080" ) ,
6+
7+ databaseHost : process . env . DATABASE_HOST || "localhost" ,
8+ databasePort : parseInt ( process . env . DATABASE_PORT || "5432" ) ,
9+ databaseName : process . env . DATABASE_NAME || "postgres" ,
10+ databaseUser : process . env . DATABASE_USER || "postgres" ,
11+ databasePassword : process . env . DATABASE_PASSWORD || "postgres" ,
12+
13+ get databaseConnectionString ( ) : string {
14+ return `postgres://${ this . databaseUser } :${ this . databasePassword } @${ this . databaseHost } :${ this . databasePort } /${ this . databaseName } `
15+ } ,
16+
17+ redisConnectionString : process . env . REDIS_CONNECTION_STRING || "redis://127.0.0.1:6379/0" ,
18+
19+ jwtSecret : process . env . JWT_SECRET || "SECRET" ,
20+ jwtExpiration : process . env . JWT_EXPIRATION || "24h" ,
21+
22+ log : function ( ) : void {
23+ console . log ( `[INFO] Webapp loaded with config:\nPORT: ${ this . appPort } \nDATABASE CONNECTION: ${ this . databaseConnectionString } \nJWT SECRET: ${ this . jwtSecret } \nJWT EXPIRATION: ${ this . jwtExpiration } \n` )
24+ }
2525}
0 commit comments