diff --git a/.env.template b/.env.template index b729b3214ba7d174e6cda0e93cc9812a79d06695..619a6dc3b7252dee3d45dd37d6d6b78edad1f1d5 100644 --- a/.env.template +++ b/.env.template @@ -1,6 +1,7 @@ # Env TAG=<version number> NODE_ENV=<dev or production> +APP_HOST=<localhost or host> # Configuration SERVICE_API_BIND_PORT=<service port> JWT_SECRET=<the secret used to sign jwt token> diff --git a/docker-compose.yml b/docker-compose.yml index 82319d9bc2aac1047027ce3ea15645204fac67e6..78c15b718ece06b1b996277d27ae272bc5a53d41 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -30,6 +30,7 @@ services: MC_API_KEY: ${MC_API_KEY} MC_SERVER: ${MC_SERVER} MC_LIST_ID: ${MC_LIST_ID} + APP_HOST: ${APP_HOST} restart: unless-stopped networks: - backend diff --git a/src/configuration/config.dev.ts b/src/configuration/config.dev.ts index 8ad7cf0d19386f9790dbb2d211c4356f427fc589..47cda9c84b0d5c180569377b2e80716587c28d3c 100644 --- a/src/configuration/config.dev.ts +++ b/src/configuration/config.dev.ts @@ -1,7 +1,7 @@ export const configDev = { url: process.env.MAIL_URL, token: process.env.MAIL_TOKEN, - host: 'resin-dev.grandlyon.com', + host: process.env.APP_HOST, protocol: 'https', port: '443', from: 'noreplyinclusionnumerique@grandlyon.com', diff --git a/src/configuration/config.prod.ts b/src/configuration/config.prod.ts index 284f817520479efd2f27b2c98a67fa4df7cba719..762b36a4e4896a7291ec25ec3337659c7639c6e6 100644 --- a/src/configuration/config.prod.ts +++ b/src/configuration/config.prod.ts @@ -1,7 +1,7 @@ export const configProd = { url: process.env.MAIL_URL, token: process.env.MAIL_TOKEN, - host: 'resin.grandlyon.com', + host: process.env.APP_HOST, protocol: 'https', port: '443', from: 'noreplyinclusionnumerique@grandlyon.com', diff --git a/src/configuration/config.rec.ts b/src/configuration/config.rec.ts index 0255a2074a4d487632345334e2ae8529ab64f2f5..e3d7990c113cd60bea65ca0c03e8e4867cc06b42 100644 --- a/src/configuration/config.rec.ts +++ b/src/configuration/config.rec.ts @@ -1,7 +1,7 @@ export const configRec = { url: process.env.MAIL_URL, token: process.env.MAIL_TOKEN, - host: 'resin-rec.grandlyon.com', + host: process.env.APP_HOST, protocol: 'https', port: '443', from: 'noreplyinclusionnumerique@grandlyon.com', diff --git a/src/configuration/config.ts b/src/configuration/config.ts index a0183191d28db8cb058061f6df19533c975d2f7d..babc27f9e0cd3376aae32f971634ffd2a7c8ffbf 100644 --- a/src/configuration/config.ts +++ b/src/configuration/config.ts @@ -1,7 +1,7 @@ export const config = { url: process.env.MAIL_URL, token: process.env.MAIL_TOKEN, - host: 'localhost', + host: process.env.APP_HOST || 'localhost', protocol: 'http', port: '4200', from: 'noreplyinclusionnumerique@grandlyon.com', diff --git a/src/configuration/configuration.service.spec.ts b/src/configuration/configuration.service.spec.ts index c194af9ce7755f35053991f7fa6efff523a3ecc6..a198aee01b2b67c114698cf296d751b042a04224 100644 --- a/src/configuration/configuration.service.spec.ts +++ b/src/configuration/configuration.service.spec.ts @@ -33,7 +33,7 @@ describe('ConfigurationService', () => { it('should init with dev conf', () => { process.env.NODE_ENV = 'dev'; - expect(configurationService.config.host).toBe('resin-dev.grandlyon.com'); + expect(configurationService.config.from_name).toBe('[DEV] Réseau des acteurs de la médiation numérique'); }); }); @@ -55,7 +55,7 @@ describe('ConfigurationService', () => { it('should init with prod conf', () => { process.env.NODE_ENV = 'production'; - expect(configurationService.config.host).toBe('resin.grandlyon.com'); + expect(configurationService.config.from_name).toBe('Réseau des acteurs de la médiation numérique'); }); });