Jacksuyu commited on
Commit
106df7f
·
1 Parent(s): 59baa12

Fix HF auth callback host with AUTH_URL fallback

Browse files
Files changed (3) hide show
  1. .env.example +1 -0
  2. Dockerfile +3 -1
  3. README.md +2 -1
.env.example CHANGED
@@ -3,5 +3,6 @@ OPENAI_API_KEY=""
3
  OPENAI_MODEL="gpt-4.1-mini"
4
 
5
  AUTH_SECRET="replace-with-long-random-secret"
 
6
  AUTH_GOOGLE_ID=""
7
  AUTH_GOOGLE_SECRET=""
 
3
  OPENAI_MODEL="gpt-4.1-mini"
4
 
5
  AUTH_SECRET="replace-with-long-random-secret"
6
+ AUTH_URL="http://localhost:3000"
7
  AUTH_GOOGLE_ID=""
8
  AUTH_GOOGLE_SECRET=""
Dockerfile CHANGED
@@ -17,6 +17,8 @@ ENV OPENAI_MODEL="gpt-4.1-mini"
17
  ENV AUTH_SECRET="change-me-in-production"
18
  ENV AUTH_GOOGLE_ID=""
19
  ENV AUTH_GOOGLE_SECRET=""
 
 
20
  ENV NODE_ENV=production
21
  ENV PORT=7860
22
 
@@ -24,4 +26,4 @@ RUN npm run prisma:generate && npm run build
24
 
25
  EXPOSE 7860
26
 
27
- CMD ["sh", "-lc", "npx prisma db push --skip-generate && npm start -- -H 0.0.0.0 -p ${PORT}"]
 
17
  ENV AUTH_SECRET="change-me-in-production"
18
  ENV AUTH_GOOGLE_ID=""
19
  ENV AUTH_GOOGLE_SECRET=""
20
+ ENV AUTH_URL=""
21
+ ENV AUTH_TRUST_HOST="true"
22
  ENV NODE_ENV=production
23
  ENV PORT=7860
24
 
 
26
 
27
  EXPOSE 7860
28
 
29
+ CMD ["sh", "-lc", "if [ -z \"$AUTH_URL\" ] && [ -n \"$SPACE_HOST\" ]; then export AUTH_URL=\"https://$SPACE_HOST\"; fi; npx prisma db push --skip-generate && npm start -- -H 0.0.0.0 -p ${PORT}"]
README.md CHANGED
@@ -52,6 +52,7 @@ Required baseline:
52
 
53
  - `DATABASE_URL` (default: `file:./dev.db`)
54
  - `AUTH_SECRET` (required for auth sessions)
 
55
 
56
  Optional LLM:
57
 
@@ -66,4 +67,4 @@ OIDC provider (currently enabled):
66
 
67
  This repo includes a `Dockerfile` for Spaces. The container initializes the SQLite schema at startup using `prisma db push` and sets a default `DATABASE_URL` internally (`file:./dev.db`).
68
 
69
- For OIDC in Spaces, configure provider callback URLs to your Space domain and set provider secrets in Space Settings -> Variables and secrets.
 
52
 
53
  - `DATABASE_URL` (default: `file:./dev.db`)
54
  - `AUTH_SECRET` (required for auth sessions)
55
+ - `AUTH_URL` (required in proxied hosting; for HF use your `.hf.space` domain)
56
 
57
  Optional LLM:
58
 
 
67
 
68
  This repo includes a `Dockerfile` for Spaces. The container initializes the SQLite schema at startup using `prisma db push` and sets a default `DATABASE_URL` internally (`file:./dev.db`).
69
 
70
+ For OIDC in Spaces, set `AUTH_URL` to your direct Space domain (for this app: `https://jacksuyu-demandsolution-codex.hf.space`), configure Google callback URL, and set secrets in Space Settings -> Variables and secrets.