- all environment variable must have a alias on 'config/config.keys.json'
the global variable must be imported with getter method form Config service EX:
AppModule.port = this._configService.get(Configuration.PORT);
- all injected component must be initialized with _
EX:
private readonly _configService: ConfigService
-
the modules folder must include all individual modules for easy deciphering
-
config module -- all environment variable and all configuration files
-
database module -- database provider(s), one or multiple provider depend of needs. Must contain all database configuration
Ex:export const databaseProviders = [ TypeOrmModule.forRootAsync({ imports: [ConfigModule], inject: [ConfigService], async useFactory(config: ConfigService) { return { // ssl: true, type: 'postgres', host: config.get(Configuration.HOST), username: config.get(Configuration.USERNAME), password: config.get(Configuration.PASSWORD), entities: [__dirname + '/../**/*.entity{.ts,.js}'], migrations: [__dirname + '/migrations/*{.ts,.js}'], } as ConnectionOptions; }, }),