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 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 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 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 '; };