Overview
Theconfig package manages all configuration settings for the Camera Workflow application. It uses Viper for flexible configuration from multiple sources: defaults, YAML files, environment variables, and command-line flags.
Types
Config
Main configuration structure containing all application settings.Configuration Fields
Directories
Source directory containing media files to convert
Destination directory for converted files
Processing
Maximum number of parallel conversion jobs
Preview mode - no files will be converted
Copy mode - files are copied without conversion
Enable checksum verification for copied files
Enable JSON output for Tauri/programmatic integration
Image Settings
Output format for photos (“avif” or “webp”)
Quality setting for AVIF conversion (1-100)
Quality setting for WebP conversion (1-100)
Video Settings
Video codec (“h265”, “h264”, or “av1”)
Constant Rate Factor for video encoding (0-51, lower = better quality)
Enable hardware acceleration when available
Organization
Organize files by date (YYYY/MM-Month/YYYY-MM-DD/)
Preserve original files after conversion
Language for month names (“en”, “fr”, “es”, “de”)
AdaptiveWorkerConfig
Configuration for adaptive worker pool management.Enable adaptive worker management
Minimum number of workers
Maximum number of workers
CPU threshold to scale down workers (%)
CPU threshold to scale up workers (%)
Memory threshold to scale down workers (% available)
Interval for checking system resources
Functions
NewConfig
Creates a new Config instance with default values and loads settings from Viper.A new Config instance with defaults and loaded settings
Example
Default Values
The following defaults are applied when values are not explicitly set:Methods
Validate
Validates configuration and derives dependent values.Returns an error if configuration is invalid
Validation Rules
- Sets
VerifyChecksum = truewhenCopyOnly = true - Ensures
MaxJobsis between 1 and CPU count - Validates adaptive worker min/max constraints
- Ensures size ratio thresholds are positive
Configuration Sources
Settings are loaded in order of priority (highest to lowest):- Command-line flags (highest priority)
- Environment variables
- YAML config file (
$HOME/.media-converter.yaml) - Default values (lowest priority)