Skip to content

Commit ceaaa14

Browse files
committed
fix: config error.
1 parent ed7fd37 commit ceaaa14

3 files changed

Lines changed: 24 additions & 5 deletions

File tree

.env.example

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,14 @@ AI_RATE_LIMIT_PER_HOUR=20
4040

4141
# ── OIDC / OAuth SSO (optional) ──
4242
# Public URL the browser can reach — used to build OIDC redirect_uri.
43-
# Dev with Vite proxy: http://localhost:5173 Docker: http://localhost:3000
44-
# (compose overrides this automatically) Prod: https://wiki.example.com
43+
# Non-docker dev (Vite proxy): set PUBLIC_BASE_URL=http://localhost:5173
44+
# Plain `make dev-backend`: leave as http://localhost:8000
45+
# Docker: ignore this — compose hardcodes
46+
# http://localhost:3000. Override the docker
47+
# value with PUBLIC_BASE_URL_DOCKER below.
48+
# Prod behind your domain: set PUBLIC_BASE_URL_DOCKER=https://wiki.example.com
4549
PUBLIC_BASE_URL=http://localhost:8000
50+
# PUBLIC_BASE_URL_DOCKER=https://wiki.example.com
4651

4752
OIDC_ENABLED=false
4853
# Comma-separated. Only providers listed here AND with a client_id+secret below are offered.

backend/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ COPY VERSION /app/VERSION
1818

1919
EXPOSE 8000
2020
HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \
21-
CMD python -c "import urllib.request,sys; sys.exit(0 if urllib.request.urlopen('http://localhost:8000/api/health',timeout=3).status==200 else 1)" || exit 1
21+
CMD python -c "__import__('urllib.request',fromlist=['request']).urlopen('http://localhost:8000/api/health',timeout=3).read()" || exit 1
2222
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]

docker-compose.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,28 @@ services:
1313
# mounted /app/data volume and treats the frontend nginx (port 3000) as
1414
# the public ingress — OIDC redirect_uri must round-trip through nginx.
1515
# TRUST_PROXY=true because nginx is the only reachable peer.
16+
#
17+
# PUBLIC_BASE_URL: hardcode the docker-correct value rather than
18+
# `${PUBLIC_BASE_URL:-...}`, because the shipped .env.example sets the
19+
# dev value (localhost:8000) and `:-default` only fires when unset, not
20+
# when set-to-something. To override for prod, set PUBLIC_BASE_URL_DOCKER
21+
# in your .env (e.g., https://wiki.example.com).
1622
environment:
1723
DATA_DIR: /app/data
1824
DB_PATH: /app/data/just-wiki.db
1925
MEDIA_DIR: /app/data/media
20-
PUBLIC_BASE_URL: ${PUBLIC_BASE_URL:-http://localhost:3000}
26+
PUBLIC_BASE_URL: ${PUBLIC_BASE_URL_DOCKER:-http://localhost:3000}
2127
TRUST_PROXY: "true"
28+
# Block-style list: docker-compose's flow-sequence parser whitespace-
29+
# splits long quoted strings into separate argv tokens. Each arg on its
30+
# own line dodges that. The Python expression must stay single-statement
31+
# for the same reason — `;` would be split too if it ever reverts.
2232
healthcheck:
23-
test: ["CMD", "python", "-c", "import urllib.request,sys; sys.exit(0 if urllib.request.urlopen('http://localhost:8000/api/health',timeout=3).status==200 else 1)"]
33+
test:
34+
- CMD
35+
- python
36+
- -c
37+
- "__import__('urllib.request',fromlist=['request']).urlopen('http://localhost:8000/api/health',timeout=3).read()"
2438
interval: 30s
2539
timeout: 5s
2640
start_period: 15s

0 commit comments

Comments
 (0)