chore: add local development env files and startup script
This commit is contained in:
19
backend/.env.development
Normal file
19
backend/.env.development
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
# memberapi.ose.tw backend env (local development)
|
||||||
|
APP_ENV=development
|
||||||
|
PORT=8000
|
||||||
|
|
||||||
|
DB_HOST=127.0.0.1
|
||||||
|
DB_PORT=54321
|
||||||
|
DB_NAME=member_center
|
||||||
|
DB_USER=member_ose
|
||||||
|
DB_PASSWORD=CHANGE_ME
|
||||||
|
|
||||||
|
AUTHENTIK_BASE_URL=
|
||||||
|
AUTHENTIK_ADMIN_TOKEN=
|
||||||
|
AUTHENTIK_VERIFY_TLS=false
|
||||||
|
AUTHENTIK_ISSUER=
|
||||||
|
AUTHENTIK_JWKS_URL=
|
||||||
|
AUTHENTIK_AUDIENCE=
|
||||||
|
|
||||||
|
PUBLIC_FRONTEND_ORIGINS=http://127.0.0.1:5173,http://localhost:5173
|
||||||
|
INTERNAL_SHARED_SECRET=CHANGE_ME
|
||||||
@@ -8,7 +8,7 @@ python -m venv .venv
|
|||||||
source .venv/bin/activate
|
source .venv/bin/activate
|
||||||
pip install -e .
|
pip install -e .
|
||||||
cp .env.example .env
|
cp .env.example .env
|
||||||
uvicorn app.main:app --host 127.0.0.1 --port 8000 --reload
|
./scripts/start_dev.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
## Required DB setup
|
## Required DB setup
|
||||||
|
|||||||
6
backend/scripts/start_dev.sh
Executable file
6
backend/scripts/start_dev.sh
Executable file
@@ -0,0 +1,6 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
cd "$(dirname "$0")/.."
|
||||||
|
source .venv/bin/activate
|
||||||
|
exec uvicorn app.main:app --env-file .env.development --host 127.0.0.1 --port 8000 --reload
|
||||||
@@ -17,10 +17,12 @@ cp .env.example .env
|
|||||||
## 3. 啟動服務
|
## 3. 啟動服務
|
||||||
```bash
|
```bash
|
||||||
cd member.ose.tw/backend
|
cd member.ose.tw/backend
|
||||||
source .venv/bin/activate
|
./scripts/start_dev.sh
|
||||||
uvicorn app.main:app --host 127.0.0.1 --port 8000 --reload
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
說明:
|
||||||
|
- `start_dev.sh` 會用 `--env-file .env.development` 啟動,不需要每次手改 `.env`
|
||||||
|
|
||||||
## 4. Authentik JWT 最小設定
|
## 4. Authentik JWT 最小設定
|
||||||
`.env` 至少填一種:
|
`.env` 至少填一種:
|
||||||
- `AUTHENTIK_JWKS_URL=<jwks endpoint>`
|
- `AUTHENTIK_JWKS_URL=<jwks endpoint>`
|
||||||
|
|||||||
@@ -79,3 +79,8 @@
|
|||||||
4. 補通知、loading、錯誤提示
|
4. 補通知、loading、錯誤提示
|
||||||
|
|
||||||
詳細 request/response 契約請看 `docs/FRONTEND_API_CONTRACT.md`。
|
詳細 request/response 契約請看 `docs/FRONTEND_API_CONTRACT.md`。
|
||||||
|
|
||||||
|
## 9. 本地開發環境
|
||||||
|
- Vite 會自動讀取 `frontend/.env.development`
|
||||||
|
- 已預設:
|
||||||
|
- `VITE_API_BASE_URL=http://127.0.0.1:8000`
|
||||||
|
|||||||
2
frontend/.env.development
Normal file
2
frontend/.env.development
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
VITE_APP_TITLE=member.ose.tw (dev)
|
||||||
|
VITE_API_BASE_URL=http://127.0.0.1:8000
|
||||||
Reference in New Issue
Block a user