AptLarder::Config
Inherits YAML::Serializable / Reference / Object
Top-level configuration loaded from a YAML file (default: apt-larder.yml).
All fields have sensible defaults so a minimal config only needs to override what differs from the defaults. Unknown keys are silently ignored.
Example
cache_dir: /var/cache/apt-larder
index_ttl: 5
max_redirects: 5
connect_timeout: 10
read_timeout: 30
log_file: /var/log/apt-larder.log
quiet: false
evict_after_days: 30
server_host: "0.0.0.0"
server_port: 3142
admin:
enabled: false
See AdminConfig for the nested admin: section.
Constructors
Instance methods
Configuration for the optional admin server (REST API + web UI).
See AdminConfig for available fields.
Configuration for the optional admin server (REST API + web UI).
See AdminConfig for available fields.
Overrides config values from env.
Convention: APT_LARDER_<FIELD> for top-level fields,
APT_LARDER_ADMIN_<FIELD> for nested admin fields.
Boolean fields accept "true", "1", "yes" (case-insensitive) as truthy.
Defaults to the process environment. Pass a plain Hash in tests to
avoid mutating ENV (which is not thread-safe on UNIX — see crystal#16449).
Call after from_yaml and before validate!.
Directory where cached packages and index files are stored on disk.
Delete cached files not accessed for this many days.
The eviction loop runs once per hour in the background. Set to 0
(default) to disable automatic eviction entirely.
Delete cached files not accessed for this many days.
The eviction loop runs once per hour in the background. Set to 0
(default) to disable automatic eviction entirely.
Minutes before a cached index file (Release, Packages, …) is
considered stale and revalidated against the upstream with a conditional
GET (If-Modified-Since).
Immutable files (.deb, paths containing /pool/ or /by-hash/) are
never subject to this TTL — they are cached forever.
Minutes before a cached index file (Release, Packages, …) is
considered stale and revalidated against the upstream with a conditional
GET (If-Modified-Since).
Immutable files (.deb, paths containing /pool/ or /by-hash/) are
never subject to this TTL — they are cached forever.
Destination for access logs.
Use "stdout" to write to standard output, or an absolute path to write
to a file. Send SIGUSR1 to reopen the file after log rotation.
Destination for access logs.
Use "stdout" to write to standard output, or an absolute path to write
to a file. Send SIGUSR1 to reopen the file after log rotation.
Minimum log severity. Accepted values (case-insensitive):
trace, debug, info, warn, error, fatal, off.
Defaults to info. Use debug to log upstream fetches and redirects.
Minimum log severity. Accepted values (case-insensitive):
trace, debug, info, warn, error, fatal, off.
Defaults to info. Use debug to log upstream fetches and redirects.
Maximum cache size in gigabytes. When exceeded, the oldest files are
deleted (LRU) until the cache fits within the limit. Set to 0 to
disable size-based eviction entirely.
Accepts both integer (0) and float (0.5) in YAML.
Maximum cache size in gigabytes. When exceeded, the oldest files are
deleted (LRU) until the cache fits within the limit. Set to 0 to
disable size-based eviction entirely.
Accepts both integer (0) and float (0.5) in YAML.
Maximum number of HTTP redirects to follow for a single upstream request.
Mirrors commonly redirect http:// to https://; this limit prevents
infinite redirect loops.
Maximum number of HTTP redirects to follow for a single upstream request.
Mirrors commonly redirect http:// to https://; this limit prevents
infinite redirect loops.
When true, only MISS and ERR lines are logged.
HIT and REVAL lines are suppressed, which significantly reduces log
volume on a warm cache where the vast majority of requests are hits.
When true, only MISS and ERR lines are logged.
HIT and REVAL lines are suppressed, which significantly reduces log
volume on a warm cache where the vast majority of requests are hits.
Upstream read timeout in seconds.
Applies to each individual read on the upstream connection, not to the total download duration. Increase for slow mirrors or very large files.
Upstream read timeout in seconds.
Applies to each individual read on the upstream connection, not to the total download duration. Increase for slow mirrors or very large files.
Host remapping table.
Maps upstream hostnames to replacement targets. The cache key always uses the original hostname so the cache remains valid if the mirror changes.
Each value can be a bare hostname (my-mirror.lan), a host:port pair,
or a full URL (http://my-mirror.lan:8080). The path is preserved.
remaps:
deb.debian.org: my-mirror.internal
security.debian.org: my-mirror.internal
Host remapping table.
Maps upstream hostnames to replacement targets. The cache key always uses the original hostname so the cache remains valid if the mirror changes.
Each value can be a bare hostname (my-mirror.lan), a host:port pair,
or a full URL (http://my-mirror.lan:8080). The path is preserved.
remaps:
deb.debian.org: my-mirror.internal
security.debian.org: my-mirror.internal
Raises ArgumentError with a descriptive message if any field contains
an invalid value. Call once after loading the config file.