class

ArrJanitor::Config

Inherits JSON::Serializable < YAML::Serializable < Reference < Object

Application configuration: a list of Sonarr/Radarr backends to watch, each with its own poll interval, bad-extension filter, and download-client credentials. Parses from either YAML or JSON.

Constants

DEFAULT_DATABASE = "arr_janitor.db"

Default SQLite database path when none is configured.

DEFAULT_RETENTION = 30.days

Default retention window for processed_downloads audit rows.

Constructors

from_file(path : String) : Config

Loads a config from path. YAML wins: .yml/.yaml parse as YAML, .json as JSON, and anything else tries YAML first then JSON.

Source
from_json(string : String) : Config

Parses a config from a JSON string.

Source
from_yaml(string : String) : Config

Parses a config from a YAML string.

Source
new(backends : Array(Backend) = [] of Backend, database : String | Nil = nil, retention : String | Nil = nil, dry_run : Bool = false, log_level : String | Nil = nil)
Source
new(*, __context_for_yaml_serializable ctx : YAML::ParseContext, __node_for_yaml_serializable node : YAML::Nodes::Node)
Source
new(*, __pull_for_json_serializable pull : JSON::PullParser)
Source

Instance methods

backends
Source
backends=(backends : Array(Backend))
Source
database

Optional path to the SQLite persistence database. See #database_path.

Source
database=(database : String | Nil)

Optional path to the SQLite persistence database. See #database_path.

Source
database_path

The SQLite database path, falling back to DEFAULT_DATABASE.

Source
dry_run=(dry_run : Bool)

When true, act as a dry run: log intended deletes/blocklists/searches without mutating Sonarr/qBittorrent or writing to the store. Can also be enabled at runtime via the --dry-run/-n CLI flag.

Source
dry_run?

When true, act as a dry run: log intended deletes/blocklists/searches without mutating Sonarr/qBittorrent or writing to the store. Can also be enabled at runtime via the --dry-run/-n CLI flag.

Source
log_level

Optional log level (one of LOG_LEVEL_NAMES, case-insensitive). Sits lowest in the precedence chain below the -l/--log-level flag and the ARR_JANITOR_LOG_LEVEL env var; an invalid value is a validation error.

Source
log_level=(log_level : String | Nil)

Optional log level (one of LOG_LEVEL_NAMES, case-insensitive). Sits lowest in the precedence chain below the -l/--log-level flag and the ARR_JANITOR_LOG_LEVEL env var; an invalid value is a validation error.

Source
retention

Optional retention window for processed-download audit rows, as <int>[m|h|d]. See #retention_span.

Source
retention=(retention : String | Nil)

Optional retention window for processed-download audit rows, as <int>[m|h|d]. See #retention_span.

Source
retention_span

The retention window as a Time::Span. Defaults to DEFAULT_RETENTION when unset/blank; raises Config::Error on a malformed value.

Source
validate

Validates the config, raising Config::Error listing all problems. Returns self when valid.

Source
validation_errors

Returns a list of all validation problems (empty when valid).

Source

Nested types