Commit e1d4503b authored by Hugo SUBTIL's avatar Hugo SUBTIL
Browse files

Merge branch 'dev' into 'master'

feat(core)! add rec confguration

See merge request !105
parents fae2f230 697aee31
Pipeline #19930 passed with stage
in 2 minutes and 44 seconds
......@@ -5,6 +5,6 @@ export const configDev = {
protocol: 'https',
port: '443',
from: 'inclusionnumerique@grandlyon.com',
from_name: 'Réseau des acteurs de la médiation numérique',
from_name: '[DEV] Réseau des acteurs de la médiation numérique',
replyTo: 'inclusionnumerique@grandlyon.com',
};
export const configRec = {
url: process.env.MAIL_URL,
token: process.env.MAIL_TOKEN,
host: 'resin-rec.grandlyon.com',
protocol: 'https',
port: '443',
from: 'inclusionnumerique@grandlyon.com',
from_name: '[REC] Réseau des acteurs de la médiation numérique',
replyTo: 'inclusionnumerique@grandlyon.com',
};
......@@ -5,7 +5,7 @@ export const config = {
protocol: 'http',
port: '4200',
from: 'noreplyinclusionnumerique@grandlyon.com',
from_name: 'Réseau des acteurs de la médiation numérique',
from_name: '[LOCAL] Réseau des acteurs de la médiation numérique',
replyTo: 'noreplyinclusionnumerique@grandlyon.com',
templates: {
directory: './src/mailer/mail-templates',
......
......@@ -3,22 +3,31 @@ import * as dotenv from 'dotenv';
import { config } from './config';
import { configProd } from './config.prod';
import { configDev } from './config.dev';
import { configRec } from './config.rec';
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 = configDev;
this._config.templates = config.templates; // Add mail templates
Logger.log('App started with dev conf', 'ConfigurationService');
} else {
this._config = config;
switch (process.env.NODE_ENV) {
case 'production':
this._config = configProd;
Logger.log('App started with production conf', 'ConfigurationService');
break;
case 'dev':
this._config = configDev;
Logger.log('App started with dev conf', 'ConfigurationService');
break;
case 'rec':
this._config = configRec;
Logger.log('App started with rec conf', 'ConfigurationService');
break;
default:
this._config = config;
Logger.warn('App started with default conf', 'ConfigurationService');
break;
}
this._config.templates = config.templates; // Add mail templates
dotenv.config();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment