From 490a24589baff4b073150b3c8860730e9d15074d Mon Sep 17 00:00:00 2001 From: tienday <> Date: Thu, 26 Oct 2023 18:14:07 +0900 Subject: [PATCH 1/3] update .env template --- frontend/.env.example | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/frontend/.env.example b/frontend/.env.example index 5f5a5b922..da85c5f13 100644 --- a/frontend/.env.example +++ b/frontend/.env.example @@ -1,3 +1,10 @@ +# app config +# PORT=3000 (default: 3000) + +# server endpoint REACT_APP_SERVER_HOST=localhost REACT_APP_SERVER_PORT=8000 +REACT_APP_SERVER_PROTO=http + +# running mode (true: standalone mode, false: multi-user mode) REACT_APP_IS_STANDALONE=true From d409360b9b95ce11b52c61815ff878ee85563394 Mon Sep 17 00:00:00 2001 From: ReiHashimoto <42664619+ReiHashimoto@users.noreply.github.com> Date: Thu, 26 Oct 2023 18:34:52 +0900 Subject: [PATCH 2/3] for-server 215, restrict access client for port forwarding --- docker-compose.dev.yml | 4 ++-- docker-compose.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index ad36e6af9..144a50985 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -9,7 +9,7 @@ services: volumes: - .:/app ports: - - "8000:8000" + - "127.0.0.1:8000:8000" command: python main.py --reload --host 0.0.0.0 --port 8000 environment: PYTHONPATH: /app/ @@ -21,7 +21,7 @@ services: volumes: - ./frontend/:/app/frontend/ ports: - - "3000:3000" + - "127.0.0.1:3000:3000" command: ash -c 'yarn install && yarn start' environment: TZ: Asia/Tokyo diff --git a/docker-compose.yml b/docker-compose.yml index 9f8c70d86..f83d298b6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -11,7 +11,7 @@ services: - ../optinist-docker-volumes/logs/:/app/logs - ../optinist-docker-volumes/studio_data/:/app/studio_data ports: - - "8000:8000" + - "127.0.0.1:8000:8000" command: python main.py --host 0.0.0.0 --port 8000 environment: PYTHONPATH: /app/ From 0b3a8f485373f585c10833b86207c3c0da93f87e Mon Sep 17 00:00:00 2001 From: ReiHashimoto <42664619+ReiHashimoto@users.noreply.github.com> Date: Thu, 26 Oct 2023 18:41:32 +0900 Subject: [PATCH 3/3] make fe protocol setting available --- frontend/src/const/API.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/frontend/src/const/API.ts b/frontend/src/const/API.ts index 935ce3ae6..029a7fa58 100644 --- a/frontend/src/const/API.ts +++ b/frontend/src/const/API.ts @@ -1,5 +1,6 @@ const HOST = process.env.REACT_APP_SERVER_HOST ?? "localhost" const PORT = process.env.REACT_APP_SERVER_PORT ?? 8000 +const PROTO = process.env.REACT_APP_SERVER_PROTO ?? "http" -export const BASE_URL = `http://${HOST}:${PORT}` -export const WS_BASE_URL = `ws://${HOST}:${PORT}` +export const BASE_URL = + PORT == null ? `${PROTO}://${HOST}` : `${PROTO}://${HOST}:${PORT}`