Specification: Configuration Settings Layer
Objective
Centralise all runtime configuration (CLI arguments, environment variables, .env files, defaults) so that the rest of the application can rely on a single read-only settings object. This layer has no dependency on network or rendering code.
1. Sources & Precedence
Command-line arguments – highest priority.
Environment variables – fallback when corresponding CLI arg is
null..env file – loaded from current working directory if present.
Hard-coded defaults – used when neither CLI, environment, nor .env provide a value.
Precedence is evaluated per setting key, not all-or-nothing.
2. Supported Settings Keys
Key |
Default |
Env Var |
CLI Flag |
Notes |
|---|---|---|---|---|
|
(required) |
|
|
Base URL of GitLab instance. |
|
none |
|
|
Exactly one key or a JSON-List of keys. Stored as list of strings. |
|
|
|
|
Enables verbose logging. |
|
|
|
|
Includes shared projects in output when true. |
|
|
|
|
Path to YAML file with column definitions (see Table Rendering & UI). |
|
|
|
|
JSON-List with strings of keywords. |
|
|
|
|
Root logger level. |
|
|
|
|
Max retries for API client. |
|
|
|
|
Seconds added per retry attempt (linear). |
3. Parsing Rules
Boolean CLI Flags are either present (=
true) or omitted (=false, the default).Boolean env vars accept
true/false,1/0,yes/no(case-insensitive).Integer/float settings validate numeric input; invalid values raise configuration error at startup.
File-path settings must point to readable files; resolved relative to the current working directory.
CLI value parsing:
List fields accept JSON arrays or a single strings
Single values are automatically converted to single-item lists
Numeric fields are automatically converted from strings
Environment variables are temporarily unset when CLI values override them
Environment variable preprocessing:
List fields (
group_api_key,todo_keywords) accept JSON arrays or a single stringSingle values are automatically converted to single-item lists
Invalid JSON (if not a single string) raises an error and aborts the program.
Validation behavior:
File existence validation shows warnings instead of errors for missing files and prints the fallback-values in the INFO-Log
Numeric fields must be non-negative (
api_retry_count,api_retry_backoff)Invalid values raise configuration errors with descriptive messages and abort the program.
4. Runtime Behaviour
Settings are evaluated once at process start and exposed as immutable object(s).
Callers use helper class methods:
current() → load from environment only.
from_args(parsed_args) → merge CLI→env→defaults precedence.
override(kwargs) → return new Settings instance with overridden values.
No part of the application may modify settings after creation.
5. Non-Goals
Does not implement command-line parsing itself; relies on an external parser to create a namespace passed to
from_args.Any dynamic reloading or hot-update of environment variables is out of scope.
6. Implementation Notes
Uses Pydantic Settings for type safety and validation
Ignores unknown fields (
extra="ignore")Provides automatic type conversion and validation