# ==============================================================================
#                          AIOStreams - .env
# ==============================================================================
# AIOStreams has TWO kinds of configuration:
#
#   1. BOOTSTRAP variables (this file) - read from the environment only, before
#      the database is available. They configure the things needed to start the
#      process (server, database, encryption, operator auth, logging).
#      These MUST be set here and cannot be changed from the dashboard.
#
#   2. RUNTIME settings - everything else (branding, presets, built-ins, proxy,
#      caching, rate limits, limits, metadata, …). These are stored in the
#      database and are best configured from the dashboard Settings page, where
#      they can be edited live and validated. Every runtime setting still has a
#      matching environment variable; setting it here locks that value (the
#      field becomes read-only in the UI). Only do that if you specifically want
#      an immutable, env-pinned value.
#
# Full reference for every variable (bootstrap AND runtime):
#   https://docs.aiostreams.viren070.me/configuration/environment-variables
#
# Upgrading from an older version? Read:
#   https://docs.aiostreams.viren070.me/migrations/v2.30
# ==============================================================================


# ==============================================================================
#                            ESSENTIAL (REQUIRED)
# ==============================================================================

# The base URL of your addon, including protocol and hostname (and port if not
# behind a reverse proxy). REQUIRED. Used for generating installation URLs,
# self-scraping detection, genre links, and built-in addon stream URLs.
# Example: https://aiostreams.yourdomain.com
BASE_URL=https://atream.charcarservices.uk

# CRITICAL: secret used to encrypt stored addon configurations.
# MUST be a 64-character hex string. Cannot be changed after first run
# (doing so makes existing encrypted configs undecryptable).
# Generate one:
#   Linux/macOS:          openssl rand -hex 32
#   Windows (PowerShell): -join ((0..31) | ForEach-Object { '{0:x2}' -f (Get-Random -Minimum 0 -Maximum 255) })
# (The legacy alias SESSION_SECRET is still accepted for one minor release.)
SECRET_KEY=af1423c51cb939f24c903f09c6f4f476bf2ed929b36105b3ad466af7e95515c3

# REQUIRED: database URI for storing addon configuration.
# Supports SQLite (simplest) or PostgreSQL.
#   SQLite:     DATABASE_URI=sqlite://./data/db.sqlite
#   PostgreSQL: DATABASE_URI=postgres://user:password@host:port/database_name
DATABASE_URI=sqlite://./data/db.sqlite

# Directory for the disk-backed caches (usenet segments, grabbed NZBs, torrent
# metadata). Defaults to `cache` under the data folder; set this to move the
# caches elsewhere (e.g. faster or non-persistent storage).
# DISK_CACHE_DIR=/mnt/scratch/aiostreams-cache


# ==============================================================================
#                                 SERVER
# ==============================================================================

# The port the addon listens on.
# PORT=3000

# Optionally override the internal URL used when communicating with built-in
# addons. The default is fine for almost all setups.
# INTERNAL_URL=http://localhost:3000

# Node environment: production (default), development, or test.
# NODE_ENV=production

# Allow the dashboard System page to stop the AIOStreams process.
# SYSTEM_LIFECYCLE_ENABLED=false


# ==============================================================================
#                    REDIS (optional — scaled deployments)
# ==============================================================================
# Only recommended when running multiple instances (e.g. Docker Swarm).
# For standard single-container setups, leave this blank — AIOStreams uses a
# faster internal memory cache that is more than sufficient.
# REDIS_URI=redis://your_redis_hostname:6379
# Redis client connect timeout in milliseconds.
# REDIS_TIMEOUT=5000

# How often (seconds) each instance polls the DB settings version and reloads
# runtime config if another instance changed a setting via the dashboard.
# Keeps multi-instance deployments consistent. Set 0 to disable on
# single-instance setups.
# SETTINGS_REFRESH_INTERVAL=30


# ==============================================================================
#                          OPERATOR AUTHENTICATION
# ==============================================================================
# Credentials for this AIOStreams instance. Comma-separated username:password pairs.
# e.g. user1:pass1,user2:pass2
# AIOSTREAMS_AUTH=

# Per-user permissions. Comma-separated `username=perm1|perm2` entries.
# Valid permissions: admin, proxy, service, sabnzbd.
#   - admin:   access the dashboard + admin-only endpoints. A superset that
#              implies every other permission.
#   - proxy:   use the built-in proxy.
#   - service: use the native usenet/debrid service.
#   - sabnzbd: use the SABnzbd-compatible API.
#   - none:    no permissions — the user may still log in to a protected config
#              page but cannot use any permission-gated feature.
# Any user NOT listed here defaults to admin (all permissions). Logging in to
# the configure page never requires a permission; the dashboard requires admin.
# e.g. alice=admin,bob=proxy|sabnzbd,carol=service,dave=none
# AIOSTREAMS_AUTH_PERMISSIONS=


# ==============================================================================
#                            PRE-DB LOGGING
# ==============================================================================
# These configure the logger.

# error | warn | info | http | verbose | debug | silly
# LOG_LEVEL=info

# text | json   (json is recommended for production)
# LOG_FORMAT=json

# In-memory buffer of recent log lines for the dashboard Logs page.
# LOG_BUFFER_MAX_BYTES=67108864
# LOG_BUFFER_MAX_ENTRIES=200000


# ==============================================================================
#                          EVERYTHING ELSE
# ==============================================================================
# All other settings — addon name/ID, presets, built-in addons, debrid/service
# credentials, stream proxy, caching, rate limits, user limits, metadata, etc.
# - are runtime settings. Configure them from the dashboard Settings page.
#
# If you must pin one via the environment, find its variable name, format, and
# default in the reference:
#   https://docs.aiostreams.viren070.me/configuration/environment-variables
# ==============================================================================
