From 23dc0744c5aa7550acb3a17f457d1e6e2e480ccf Mon Sep 17 00:00:00 2001 From: Xin Feng <126309503+danielxfeng@users.noreply.github.com> Date: Sat, 21 Feb 2026 21:00:14 +0200 Subject: [PATCH] docs: update README and .env.sample for backend configuration clarity --- README.md | 14 ++++++++++++-- backend/.env.sample | 20 +++++++++++--------- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 157d62e..8887413 100644 --- a/README.md +++ b/README.md @@ -75,19 +75,29 @@ cd auth-user-prototype ```bash cd backend +cp .env.sample .env make dev ``` Then navigate to `http://localhost:3003/api/docs/index.html` for swagger. -Redis is optional. To enable it locally: +Required env vars for backend startup: + +- `JWT_SECRET` +- `GOOGLE_CLIENT_ID` +- `GOOGLE_CLIENT_SECRET` + +The provided `backend/.env.sample` already includes local placeholder values for these, so backend can start even if you are not testing Google OAuth. + +Redis is optional. In local development it is disabled by default (`REDIS_URL=` in `.env`). +To enable Redis locally: ```bash # example: run redis with docker docker run --rm -p 6379:6379 redis:latest # enable redis mode for the backend -export REDIS_URL=redis://localhost:6379/0 +export REDIS_URL=redis://localhost:6379/0 # or set it in backend/.env ``` Token extension (sliding expiration) in Redis mode: diff --git a/backend/.env.sample b/backend/.env.sample index d929ca0..a5cfa41 100644 --- a/backend/.env.sample +++ b/backend/.env.sample @@ -2,10 +2,10 @@ PORT=3003 # Db address -DB_ADDRESS=data/sqlite3.db +DB_ADDRESS=data/auth_service_db.sqlite -# Redis address, leave empty to disable Redis -REDIS_URL=rediss://example-redis.upstash.io +# Redis URL, keep empty to disable Redis in local development +REDIS_URL= # JWT JWT_SECRET=not-dev-secret @@ -16,17 +16,19 @@ OAUTH_STATE_TOKEN_EXPIRY=300 USER_TOKEN_ABSOLUTE_EXPIRY=2592000 # 30 days # Google OAuth -GOOGLE_CLIENT_ID=100000000-e3dsadsadsa321321.apps.googleusercontent.com -GOOGLE_CLIENT_SECRET=GLUTPL-_dsa43_DSADSADSadsadsadsaC -GOOGLE_REDIRECT_URI=https://c2r5p11.hive.fi:5173/api/users/google/callback +# GOOGLE_CLIENT_ID / GOOGLE_CLIENT_SECRET are required by config loader. +# Use real values if you need Google OAuth; placeholder values still allow backend startup. +GOOGLE_CLIENT_ID=local-dev-google-client-id +GOOGLE_CLIENT_SECRET=local-dev-google-client-secret +GOOGLE_REDIRECT_URI=http://localhost:3003/api/users/google/callback # Frontend URL -FRONTEND_URL=https://c2r5p11.hive.fi:5173 +FRONTEND_URL=http://localhost:5173 # 2FA -TWO_FA_URL_PREFIX=otpauth://totp/aaa?secret= +TWO_FA_URL_PREFIX=otpauth://totp/AuthServicePrototype?secret= # Rate Limiter RATE_LIMITER_DURATION_IN_SECONDS=60 RATE_LIMITER_REQUEST_LIMIT=1000 -RATE_LIMITER_CLEANUP_INTERVAL_IN_SECONDS=300 \ No newline at end of file +RATE_LIMITER_CLEANUP_INTERVAL_IN_SECONDS=300