Overview
Aceplay supports configuration through environment variables, which is useful for:- Containerized environments (Docker, Kubernetes)
- CI/CD pipelines
- Temporary configuration overrides
- Scripts and automation
ACEPLAY_ prefix.
Environment Variable Prefix
Aceplay automatically reads environment variables with theACEPLAY_ prefix. The configuration system (Viper) is set up in internal/config/config.go:104 with:
Supported Environment Variables
Player Configuration
Video player to use for playback.Valid values:
mpv, vlc, ffplayTimeout Settings
Maximum time to wait for a stream to become ready.Format: Duration string (e.g.,
60s, 2m, 1m30s)Maximum time to wait when connecting to acestream-engine.
Stream Options
Enable HLS (HTTP Live Streaming) mode.Valid values:
true, falseEnable verbose logging for detailed output.
Engine Configuration
Hostname or IP address of the acestream-engine.
Port number for the acestream-engine HTTP API.
Automatically start acestream-engine if not running.
Custom command to start the acestream-engine.
Configuration Precedence
Configuration values are resolved in the following order (highest priority first):- Command-line flags - Direct flags passed to the command
- Environment variables -
ACEPLAY_*variables - Configuration file -
~/.config/aceplay/config.yaml - Default values - Built-in defaults
Precedence Example
Given this configuration file:- Player:
vlc(from environment variable, overrides config file) - Engine host:
192.168.1.50(from environment variable, overrides config file) - Engine port:
6878(from config file)
- Player:
ffplay(from CLI flag, highest priority) - Engine host:
192.168.1.50(from environment variable) - Engine port:
6878(from config file)
Usage Examples
Basic Usage
Set environment variables before running Aceplay:One-Time Override
Set variables for a single command:Docker Container
Pass environment variables to a Docker container:Docker Compose
Define environment variables indocker-compose.yml:
Shell Script
Create a wrapper script with custom environment:Environment File
Create a.env file:
export:
Environment Variables vs Config File
| Use Case | Recommended Method |
|---|---|
| Persistent settings | Config file (~/.config/aceplay/config.yaml) |
| Temporary overrides | Environment variables |
| Container deployments | Environment variables |
| CI/CD pipelines | Environment variables |
| Multi-environment setups | Environment variables |
| User preferences | Config file |
| Scripts and automation | Environment variables |
Variable Name Mapping
Environment variable names map to configuration file keys:| Environment Variable | Config File Key | CLI Flag |
|---|---|---|
ACEPLAY_PLAYER | player | --player |
ACEPLAY_TIMEOUT | timeout | --timeout |
ACEPLAY_CONNECT_TIMEOUT | connect_timeout | N/A |
ACEPLAY_HLS | hls | --hls |
ACEPLAY_VERBOSE | verbose | --verbose |
ACEPLAY_ENGINE_HOST | engine.host | --engine-host |
ACEPLAY_ENGINE_PORT | engine.port | --engine-port |
ACEPLAY_ENGINE_AUTO_START | engine.auto_start | N/A |
ACEPLAY_ENGINE_AUTO_START_COMMAND | engine.auto_start_command | N/A |
Nested configuration keys use underscores in environment variables. For example,
engine.host becomes ACEPLAY_ENGINE_HOST.