Repository navigation
Expand file tree
/
Copy path.env.example
More file actions
65 lines (57 loc) · 2.37 KB
/
Copy path.env.example
File metadata and controls
65 lines (57 loc) · 2.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# Environment variables for basic-api. Copy to .env and fill in; never commit
# .env. Every variable is read and validated in src/basic_api/config.py; keep
# that module and this file in step.
# --- Application ---
# development | staging | production. In production the interactive docs are
# off unless ENABLE_DOCS=true.
ENVIRONMENT=development
# Force /docs, /redoc and /openapi.json on (true) or off (false); unset = by ENVIRONMENT.
# ENABLE_DOCS=true
# Reported by GET / and the OpenAPI document; unset = the version in pyproject.toml.
# APP_VERSION=1.2.3
# Path prefix when served behind a reverse proxy, e.g. /api-name; unset = none.
# ROOT_PATH=
# --- Logging ---
# DEBUG, INFO, WARNING, ERROR or CRITICAL
LOG_LEVEL=INFO
# json (one object per line, for collectors) or text; unset = json in
# production, text elsewhere.
# LOG_FORMAT=text
# --- CORS (comma-separated) ---
# "*" suits native apps; a browser frontend should list its origins.
CORS_ORIGINS=*
CORS_METHODS=*
CORS_HEADERS=*
# --- Database ---
DATABASE_URL=postgresql+asyncpg://user:password@localhost:5432/basic_api
# Log every SQL statement (development only)
DATABASE_ECHO=false
# Test database (tests/conftest.py builds its URL from these; the app does the
# same when running under pytest, so both hit the same database)
DB_USER=postgres
DB_PASSWORD=your_postgres_password
DB_HOST=localhost
DB_PORT=5432
TEST_DB_NAME=basic_api_test_db
# --- Security ---
# Client API key, sent as X-API-Key on every /api route. It identifies your
# own clients; it is not a user credential.
API_KEY=your-secret-api-key-here
# JWT signing secret: at least 32 bytes for HS256 (48 for HS384, 64 for HS512),
# or the app refuses to start.
# Generate: python -c "import secrets; print(secrets.token_urlsafe(32))"
JWT_SECRET_KEY=replace_with_a_secure_random_value_of_32_bytes_or_more
# One of HS256, HS384, HS512
JWT_ALGORITHM=HS256
# Default token lifetime in minutes
JWT_ACCESS_TOKEN_EXPIRE_MINUTES=30
# Longest lifetime a client may request at login via ?expires_delta= (default 7 days)
JWT_MAX_ACCESS_TOKEN_EXPIRE_MINUTES=10080
# Bcrypt cost; 12 is the minimum the app accepts
BCRYPT_ROUNDS=12
# --- Request size ---
# Largest request body in bytes; larger requests get 413 before any route runs
MAX_REQUEST_BODY_BYTES=1048576
# --- Rate limits (per client IP, `limits` syntax: 10/minute, 100/hour) ---
RATE_LIMIT_LOGIN=60/minute
RATE_LIMIT_REGISTER=10/minute