βοΈ Configuration¶
Configure the Epguides API using environment variables.
Quick Setup
Copy .env.example to .env and customize for your environment.
π Environment Variables¶
ποΈ Redis¶
| Variable | Default | Description |
|---|---|---|
REDIS_HOST |
redis |
Redis server hostname |
REDIS_PORT |
6379 |
Redis server port |
REDIS_DB |
0 |
Redis database number |
REDIS_PASSWORD |
- | Redis password (optional) |
REDIS_MAX_CONNECTIONS |
100 |
Max pool connections (~10 per worker) |
β±οΈ Cache¶
| Variable | Default | Description |
|---|---|---|
CACHE_TTL_SECONDS |
604800 |
Default cache TTL (7 days) |
π API¶
| Variable | Default | Description |
|---|---|---|
API_BASE_URL |
http://localhost:3000/ |
Base URL for generated links |
π€ LLM (Optional)¶
| Variable | Required | Description |
|---|---|---|
LLM_ENABLED |
βͺ | Set to true to enable NLQ |
LLM_API_URL |
If enabled | LLM gateway base URL |
LLM_API_KEY |
If needed | API key for authentication |
LLM_MODEL_NAME |
βͺ | Model name sent to the gateway (auto by default) |
LLM_ALLOW_EXTERNAL |
βͺ | Set to true only for deliberate non-default endpoint experiments |
π Logging¶
| Variable | Default | Description |
|---|---|---|
LOG_LEVEL |
INFO |
Log level (DEBUG, INFO, WARNING, ERROR) |
LOG_REQUESTS |
true |
Enable request logging |
π Example .env¶
# Redis (production)
REDIS_HOST=redis
REDIS_PORT=6379
REDIS_PASSWORD=your-secure-password
REDIS_MAX_CONNECTIONS=100
# API
API_BASE_URL=https://your-domain.com/
# LLM (optional)
LLM_ENABLED=true
LLM_API_URL=https://your-llm-server.example.com/v1
LLM_MODEL_NAME=auto
LLM_API_KEY=your-gateway-token
# Logging (less verbose)
LOG_LEVEL=WARNING
LOG_REQUESTS=false
π€ LLM Endpoint Policy¶
Gateway-first
Natural-language episode filtering is routed through the configured LLM gateway. External base URLs are ignored by default; set LLM_ALLOW_EXTERNAL=true only for intentional local experiments.
LLM_ENABLED=true
LLM_API_URL=https://your-llm-server.example.com/v1
LLM_MODEL_NAME=auto
LLM_API_KEY=your-gateway-token
β‘ Caching Strategy¶
Smart Caching
The API uses intelligent caching to minimize external requests while keeping data fresh.
β° Cache Durations¶
| Data Type | Duration | Rationale |
|---|---|---|
| β Finished shows | 1 year | Data won't change |
| π Shows master list | 30 days | New shows added infrequently |
| βΆοΈ Ongoing shows | 7 days | Episodes air weekly at most |
π Cache Flow¶
Request comes in
β
βΌ
βββββββββββ Yes βββββββββββββββ
βrefresh= βββββββββΆβ Fetch fresh β
β true? β β data β
ββββββ¬βββββ βββββββββββββββ
β No
βΌ
βββββββββββ Yes βββββββββββββββ
βIn cache?βββββββββΆβReturn cachedβ
ββββββ¬βββββ βββββββββββββββ
β No
βΌ
βββββββββββββ
βFetch from β
βexternal β
βAPIs β
βββββββ¬ββββββ
β
βΌ
ββββββββββββ Yes
βShow has ββββββββΆ Cache 1 year (finished)
βend_date? β
ββββββ¬ββββββ
β No
βΌ
Cache 7 days (ongoing)
π Automatic Behaviors¶
| Feature | Behavior |
|---|---|
| β Finished Shows | When end_date is set, cache extends to 1 year |
| π Manual Refresh | Use ?refresh=true to bypass cache |
β° Smart /next |
Auto-refreshes when cached episode date has passed |
β Verification¶
π Check API Health¶
π€ Check LLM Status¶
Expected response when configured: