Skip to content
Snippets Groups Projects
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 web-et-numerique/pamn_plateforme-des-acteurs-de-la-mediation-numerique/pamn_server!105
parents fae2f230 697aee31
No related branches found
No related tags found
1 merge request!105feat(core)! add rec confguration
...@@ -5,6 +5,6 @@ export const configDev = { ...@@ -5,6 +5,6 @@ export const configDev = {
protocol: 'https', protocol: 'https',
port: '443', port: '443',
from: 'inclusionnumerique@grandlyon.com', 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', 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 = { ...@@ -5,7 +5,7 @@ export const config = {
protocol: 'http', protocol: 'http',
port: '4200', port: '4200',
from: 'noreplyinclusionnumerique@grandlyon.com', 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', replyTo: 'noreplyinclusionnumerique@grandlyon.com',
templates: { templates: {
directory: './src/mailer/mail-templates', directory: './src/mailer/mail-templates',
......
...@@ -3,22 +3,31 @@ import * as dotenv from 'dotenv'; ...@@ -3,22 +3,31 @@ import * as dotenv from 'dotenv';
import { config } from './config'; import { config } from './config';
import { configProd } from './config.prod'; import { configProd } from './config.prod';
import { configDev } from './config.dev'; import { configDev } from './config.dev';
import { configRec } from './config.rec';
export class ConfigurationService { export class ConfigurationService {
private readonly _config; private readonly _config;
constructor() { constructor() {
// Initializing conf with values from var env // Initializing conf with values from var env
if (process.env.NODE_ENV && process.env.NODE_ENV === 'production') { switch (process.env.NODE_ENV) {
this._config = configProd; case 'production':
this._config.templates = config.templates; // Add mail templates this._config = configProd;
Logger.log('App started with production conf', 'ConfigurationService'); Logger.log('App started with production conf', 'ConfigurationService');
} else if (process.env.NODE_ENV && process.env.NODE_ENV === 'dev') { break;
this._config = configDev; case 'dev':
this._config.templates = config.templates; // Add mail templates this._config = configDev;
Logger.log('App started with dev conf', 'ConfigurationService'); Logger.log('App started with dev conf', 'ConfigurationService');
} else { break;
this._config = config; 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(); dotenv.config();
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment