Newer
Older
import { Logger } from '@nestjs/common';
import * as dotenv from 'dotenv';
import { configProd } from './config.prod';
export class ConfigurationService {
private readonly _config;
constructor() {
// Initializing conf with values from var env
if (process.env.NODE_ENV && process.env.NODE_ENV === 'production') {
this._config = configProd;
this._config.templates = config.templates; // Add mail templates
Logger.log('App started with production conf', 'ConfigurationService');
} else if (process.env.NODE_ENV && process.env.NODE_ENV === 'dev') {
this._config.templates = config.templates; // Add mail templates
Logger.log('App started with dev conf', 'ConfigurationService');
this._config = config;
Logger.log('App started with local conf', 'ConfigurationService');
dotenv.config();
}
public isLocalConf(): boolean {
return process.env.NODE_ENV === 'local';
}
get config() {
return this._config;
}