Skip to content

Latest commit

 

History

History
91 lines (66 loc) · 1.6 KB

File metadata and controls

91 lines (66 loc) · 1.6 KB

Windows Setup

Requirements

  • Python 3.12+
  • PowerShell
  • Git
  • Docker Desktop for the container workflow

Local SQLite workflow

Expand-Archive enterprise-auth-module-v3.zip
cd enterprise-auth-module-v3
python -m venv .venv
.\.venv\Scripts\Activate.ps1
python -m pip install --upgrade pip
pip install -r requirements.txt
Copy-Item .env.example .env

Edit .env:

DATABASE_URL=sqlite:///./auth_service.db
REDIS_URL=
SECRET_KEY=replace-with-a-long-random-development-secret
ENCRYPTION_SECRET=replace-with-another-long-random-secret

Initialize and run:

alembic upgrade head
python -m scripts.seed
uvicorn app.main:app --reload

Visit http://127.0.0.1:8000/docs.

Docker workflow

Copy-Item .env.example .env
docker compose up --build

In a second PowerShell window:

docker compose exec api python -m scripts.seed

Common issues

PowerShell blocks activation

Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
.\.venv\Scripts\Activate.ps1

Port 8000 is busy

uvicorn app.main:app --reload --port 8010

Reset local SQLite data

Remove-Item auth_service.db -ErrorAction SilentlyContinue
alembic upgrade head
python -m scripts.seed

cors_origins or trusted_hosts parsing error

The patched configuration accepts either format:

CORS_ORIGINS=http://localhost:3000,http://localhost:5173
TRUSTED_HOSTS=localhost,127.0.0.1

or JSON:

CORS_ORIGINS=["http://localhost:3000","http://localhost:5173"]
TRUSTED_HOSTS=["localhost","127.0.0.1"]