From 3e9fbeeba1090c786f38919f248cf8c91516fcee Mon Sep 17 00:00:00 2001 From: Pierre Gauthier Date: Thu, 3 Oct 2024 14:18:17 +0200 Subject: [PATCH] Fix fallback on api domain --- compose.connectors.yml | 10 +++------- compose.override.yaml => compose.override.yml | 6 +++--- compose.yml | 8 ++++---- 3 files changed, 10 insertions(+), 14 deletions(-) rename compose.override.yaml => compose.override.yml (90%) diff --git a/compose.connectors.yml b/compose.connectors.yml index e215b1b6c..a57dfb5ad 100644 --- a/compose.connectors.yml +++ b/compose.connectors.yml @@ -1,14 +1,10 @@ services: - php: - environment: - - TRUSTED_HOSTS=${TRUSTED_HOSTS:-^${API_SERVER_NAME:-example\.com|api.localhost}|php$$} - - caddy: + proxy: networks: default: aliases: - - ${API_SERVER_NAME:-api.localhost} + - ${API_SERVER_NAME:-api.gally.localhost} -networks: +networks: default: name: 'connectors-proxy' diff --git a/compose.override.yaml b/compose.override.yml similarity index 90% rename from compose.override.yaml rename to compose.override.yml index edadeeeae..db928cdad 100644 --- a/compose.override.yaml +++ b/compose.override.yml @@ -36,7 +36,7 @@ services: target: gally_pwa_dev args: - NEXT_PUBLIC_ENTRYPOINT=${SERVER_NAME:-gally.localhost} - - NEXT_PUBLIC_API_URL=https://${SERVER_NAME:-${API_SERVER_NAME:-api.gally.localhost}}/${API_ROUTE_PREFIX:-} + - NEXT_PUBLIC_API_URL=https://${API_SERVER_NAME:-${SERVER_NAME:-api.gally.localhost}}/${API_ROUTE_PREFIX:-} volumes: - ./front:/usr/src/front:rw,cached,z environment: @@ -51,12 +51,12 @@ services: additional_contexts: front_src: ./front args: - - REACT_APP_API_URL=https://${SERVER_NAME:-${API_SERVER_NAME:-api.gally.localhost}}/${API_ROUTE_PREFIX:-} + - REACT_APP_API_URL=https://${API_SERVER_NAME:-${SERVER_NAME:-api.gally.localhost}}/${API_ROUTE_PREFIX:-} volumes: - ./front:/usr/src/front:rw,cached,z environment: - PUBLIC_URL=https://${SERVER_NAME:-gally.localhost}/example - - REACT_APP_API_URL=https://${SERVER_NAME:-${API_SERVER_NAME:-api.gally.localhost}}/${API_ROUTE_PREFIX:-} + - REACT_APP_API_URL=https://${API_SERVER_NAME:-${SERVER_NAME:-api.gally.localhost}}/${API_ROUTE_PREFIX:-} ###> doctrine/doctrine-bundle ### database: diff --git a/compose.yml b/compose.yml index 71bff03e7..9724398f9 100644 --- a/compose.yml +++ b/compose.yml @@ -78,7 +78,7 @@ services: - SERVER_NAME=${SERVER_NAME:-${API_SERVER_NAME:-api.gally.localhost}}, php:80 - API_ROUTE_PREFIX=${API_ROUTE_PREFIX:-} - TRUSTED_PROXIES=${TRUSTED_PROXIES:-127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16} - - TRUSTED_HOSTS=${TRUSTED_HOSTS:-^${SERVER_NAME:-example\.com|api.gally.localhost}|localhost|php$$} + - TRUSTED_HOSTS=${TRUSTED_HOSTS:-^${SERVER_NAME:-|gally.localhost}|${API_SERVER_NAME:-|api.gally.localhost}|localhost|php$$} - CORS_ALLOW_ORIGIN=^https?://${SERVER_NAME:-gally.localhost}$ - GALLY_CATALOG_MEDIA_URL=${GALLY_CATALOG_MEDIA_URL:-https://${SERVER_NAME:-gally.localhost}/media/catalog/product/} - DATABASE_URL=postgresql://${POSTGRES_USER:-app}:${POSTGRES_PASSWORD:-!ChangeMe!}@database:5432/${POSTGRES_DB:-app}?serverVersion=${POSTGRES_VERSION:-16}&charset=${POSTGRES_CHARSET:-utf8} @@ -93,12 +93,12 @@ services: front_src: ./front args: - NEXT_PUBLIC_ENTRYPOINT=${SERVER_NAME:-gally.localhost} - - NEXT_PUBLIC_API_URL=https://${SERVER_NAME:-${API_SERVER_NAME:-api.gally.localhost}}/${API_ROUTE_PREFIX:-} + - NEXT_PUBLIC_API_URL=https://${API_SERVER_NAME:-${SERVER_NAME:-api.gally.localhost}}/${API_ROUTE_PREFIX:-} - REACT_APP_API_URL=https://${SERVER_NAME:-${API_SERVER_NAME:-api.gally.localhost}}/${API_ROUTE_PREFIX:-} environment: - NEXT_PUBLIC_ENTRYPOINT=${SERVER_NAME:-gally.localhost} - - NEXT_PUBLIC_API_URL=https://${SERVER_NAME:-${API_SERVER_NAME:-api.gally.localhost}}/${API_ROUTE_PREFIX:-} - - REACT_APP_API_URL=https://${SERVER_NAME:-${API_SERVER_NAME:-api.gally.localhost}}/${API_ROUTE_PREFIX:-} + - NEXT_PUBLIC_API_URL=https://${API_SERVER_NAME:-${SERVER_NAME:-api.gally.localhost}}/${API_ROUTE_PREFIX:-} + - REACT_APP_API_URL=https://${API_SERVER_NAME:-${SERVER_NAME:-api.gally.localhost}}/${API_ROUTE_PREFIX:-} healthcheck: test: test $$(curl --connect-timeout 2 -s -o /dev/null -w ''%{http_code}'' http://localhost:3000) -eq 200 interval: 10s