import * as dotenv from "dotenv" ; import IORedis from "ioredis" ; import { MongoConnectionOptions } from "src/common/Mongoer" ; import { ConnectionOptions } from "typeorm" ; dotenv . config ( { path : `./.env.${ process . env . NODE_ENV }` } ) ; const staticPath = process . env . STATIC_PATH || `${ process . cwd ( ) }/public` ; console . info ( staticPath . bgBlue ) ; export interface IConfig { readonly port : number ; readonly websocket ? : boolean ; readonly cluster ? : boolean ; readonly logger ? : boolean ; readonly sessionSecret : string ; readonly mongo ? : MongoConnectionOptions ; readonly orm ? : ConnectionOptions ; readonly redis ? : IORedis . RedisOptions ; } export interface IStaticConfig { readonly staticPrefix : string ; readonly staticPath : string ; readonly libPath : string ; } export const defaultStaticConfig = { staticPrefix : "/public/" , staticPath , libPath : process . env . LIBS_PATH || `${ staticPath }/libs` , } ; export const defaultConfig = { port : 3838 , websocket : true , cluster : false , logger : false , sessionSecret : "a secret with minimum length of 32 characters" , mongo : { uris : "mongodb://localhost:27017/" , options : { dbName : "mojito" , useNewUrlParser : true , useUnifiedTopology : true , autoIndex : false , serverSelectionTimeoutMS : 5000 , bufferCommands : false , useFindAndModify : false , } , } , } ;