My app instance depends on configuration : serviceName
in that case
const serviceName = 'authentication-service'
const servicePrefix = `api/${serviceName}`;
const swaggerPrefix = 'swagger';
...
const app = await NestFactory.create<NestFastifyApplication>(
AppModule,
new FastifyAdapter({
requestIdLogLabel: serviceName,
logger: true,
...
}),
{
// logger: ['log']
logger: process.env.DEV === '1' ? ['log', 'debug', 'error', 'verbose', 'warn'] : ['error', 'warn'],
});
NestJs documentation uses app instance to get the configService
singleton :
const configService = app.get(ConfigService);
const port = configService.get('PORT');
Is there any way to get the configService
instance before instantiating my app?