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/ 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 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}`