# Stripstream Librarian - Environment Configuration
#
# HOW TO USE:
# 1. Copy this file to .env: cp .env.example .env
# 2. Change the REQUIRED values below
# 3. Run: docker-compose up --build

# =============================================================================
# REQUIRED - Change these values in production!
# =============================================================================

# Bootstrap token for initial API admin access (required)
# Use this token for the first API calls before creating proper API tokens
API_BOOTSTRAP_TOKEN=change-me-in-production

# Backoffice admin credentials (required)
ADMIN_USERNAME=admin
ADMIN_PASSWORD=change-me-in-production
# Secret for signing session JWTs (min 32 chars, required)
SESSION_SECRET=change-me-in-production-use-32-chars-min

# =============================================================================
# Service Configuration
# =============================================================================

# API Service
API_LISTEN_ADDR=0.0.0.0:7080
API_BASE_URL=http://api:7080

# Indexer Service
INDEXER_LISTEN_ADDR=0.0.0.0:7081
INDEXER_SCAN_INTERVAL_SECONDS=5

# PostgreSQL Database
DATABASE_URL=postgres://stripstream:stripstream@postgres:5432/stripstream

# =============================================================================
# Logging
# =============================================================================
# Log levels per domain. Default: indexer=info,scan=info,extraction=info,thumbnail=warn,watcher=info
# Domains:
#   scan        — filesystem scan (discovery phase)
#   extraction  — page extraction from archives (extracting_pages phase)
#   thumbnail   — thumbnail generation (resize/encode)
#   watcher     — file watcher polling
#   indexer     — general indexer logs
# Levels: error, warn, info, debug, trace
# Examples:
#   RUST_LOG=indexer=info                                     # default, quiet thumbnails
#   RUST_LOG=indexer=info,thumbnail=debug                     # enable thumbnail timing logs
#   RUST_LOG=indexer=info,extraction=debug                    # per-book extraction details
#   RUST_LOG=indexer=debug,scan=debug,extraction=debug,thumbnail=debug,watcher=debug  # tout voir
# RUST_LOG=indexer=info,scan=info,extraction=info,thumbnail=warn,watcher=info

# =============================================================================
# Storage Configuration
# =============================================================================

# Path to libraries directory inside container
# In Docker: leave as default /libraries
# For local dev: set to your local libraries folder path
LIBRARIES_ROOT_PATH=/libraries

# Path to libraries directory on host machine (for Docker volume mount)
# Default: ../libraries (relative to infra/docker-compose.yml)
# You can change this to an absolute path on your machine
LIBRARIES_HOST_PATH=./libraries

# Path to thumbnails directory on host machine (for Docker volume mount)
# Default: ../data/thumbnails (relative to infra/docker-compose.yml)
THUMBNAILS_HOST_PATH=./data/thumbnails

# Path to qBittorrent downloads directory on host machine (for Docker volume mount)
# The container will see this as /downloads
DOWNLOADS_HOST_PATH=./data/downloads

# Path to downloads directory inside the container (for dev remapping, like LIBRARIES_ROOT_PATH)
# In Docker: leave as default /downloads
# For local dev: set to your local downloads folder path
# DOWNLOADS_PATH=/downloads

# =============================================================================
# Port Configuration
# =============================================================================
# To change ports, edit docker-compose.yml directly:
# - API: change "7080:7080" to "YOUR_PORT:7080"
# - Indexer: change "7081:7081" to "YOUR_PORT:7081"
# - Backoffice: change "7082:7082" to "YOUR_PORT:7082"
# - PostgreSQL: change "6432:5432" to "YOUR_PORT:5432"
