From d7e5d5bd3865755e5701965defe1bc4e2a16d0ae Mon Sep 17 00:00:00 2001 From: Daniel Murray Date: Thu, 20 Jun 2024 16:21:09 +0100 Subject: [PATCH 1/4] add docker compose override for dev mode --- docker-compose.yml | 2 -- .../docker/development/docker-compose.override.yml | 5 +++++ 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 infrastructure/docker/development/docker-compose.override.yml diff --git a/docker-compose.yml b/docker-compose.yml index 028bcad..c4c5401 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,8 +7,6 @@ services: dockerfile: ./infrastructure/docker/${NODE_ENV}/Dockerfile ports: - "${PORT}:3000" - volumes: - - ./:/app environment: - NODE_ENV=${NODE_ENV} - PATH_SSL_PRIVATE_KEY=${PATH_SSL_PRIVATE_KEY} diff --git a/infrastructure/docker/development/docker-compose.override.yml b/infrastructure/docker/development/docker-compose.override.yml new file mode 100644 index 0000000..36ace3b --- /dev/null +++ b/infrastructure/docker/development/docker-compose.override.yml @@ -0,0 +1,5 @@ +version: '3' +services: + web: + volumes: + - ./:/app \ No newline at end of file From e4360e94e866b124c51a2178aab0ab418212e5d7 Mon Sep 17 00:00:00 2001 From: Daniel Murray Date: Thu, 20 Jun 2024 16:23:21 +0100 Subject: [PATCH 2/4] add conditional clause to makefile for dev mode --- Makefile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 053d29d..d6235c2 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,7 @@ .PHONY: clean build lint test coverage docker-up docker-build +include .env + NODE_VERSION_SUPPORTED := >=20.0.0 NODE_VERSION=$(shell node -v) @@ -17,8 +19,13 @@ docker-build: docker compose -f docker-compose.yml build docker-up: - $(info webapp starting) +ifeq ($(NODE_ENV),development) + $(info Building development environment) + docker compose -f docker-compose.yml -f ./infrastructure/docker/development/docker-compose.override.yml up +else + $(info Building production environment) docker compose -f docker-compose.yml up +endif lint: npm run lint From 68ea7a5c5cc85c93337557333b0029c9b62340d2 Mon Sep 17 00:00:00 2001 From: Daniel Murray Date: Thu, 20 Jun 2024 16:23:48 +0100 Subject: [PATCH 3/4] remove quotes from .env.example --- .env.example | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.env.example b/.env.example index 8091dbf..fe8c231 100644 --- a/.env.example +++ b/.env.example @@ -1,12 +1,12 @@ -PATH_SSL_PRIVATE_KEY="./infrastructure/host/test.key" -PATH_SSL_CERTIFICATE="./infrastructure/host/test.cert" +PATH_SSL_PRIVATE_KEY=./infrastructure/host/test.key +PATH_SSL_CERTIFICATE=./infrastructure/host/test.cert PORT=3000 NODE_ENV=development -BASE_URL="http://localhost:3000" -CDN_HOST="d6nh3dxv55e16.cloudfront.net" -NODE_SSL_ENABLED="false" +BASE_URL=http://localhost:3000 +CDN_HOST=test +NODE_SSL_ENABLED=false LOG_LEVEL=info HUMAN=true \ No newline at end of file From fb9ec975b7f8ce95f4986483eb34c6b3306038ba Mon Sep 17 00:00:00 2001 From: DanielMurray97 Date: Mon, 24 Jun 2024 14:03:08 +0100 Subject: [PATCH 4/4] assess pr comments --- src/config/index.ts | 2 +- test/setup.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/config/index.ts b/src/config/index.ts index 31d3dc9..03d13c7 100644 --- a/src/config/index.ts +++ b/src/config/index.ts @@ -2,7 +2,7 @@ import { getEnvironmentValue } from '../utils/getEnvironmentValue'; export const PORT = getEnvironmentValue('PORT', '3000'); export const BASE_URL = getEnvironmentValue('BASE_URL', `http://localhost:${PORT}`); -export const CDN_HOST = getEnvironmentValue('CDN_HOST', 'd6nh3dxv55e16.cloudfront.net'); +export const CDN_HOST = getEnvironmentValue('CDN_HOST'); export const NODE_SSL_ENABLED = getEnvironmentValue('NODE_SSL_ENABLED', 'false'); export const PATH_SSL_PRIVATE_KEY = getEnvironmentValue('PATH_SSL_PRIVATE_KEY', 'false'); diff --git a/test/setup.ts b/test/setup.ts index 1647a8d..484c925 100644 --- a/test/setup.ts +++ b/test/setup.ts @@ -2,5 +2,6 @@ export default () => { process.env.LOG_LEVEL = 'info'; process.env.HUMAN = 'true'; process.env.TEST_KEY = 'test'; + process.env.CDN_HOST = 'test'; process.env.UNSANITISED_TEST_KEY = ' test '; };