winbrew_models\shared/config.rs
1//! Configuration view models and value provenance.
2//!
3//! These types are the presentation layer for configuration data. They do not
4//! read or write configuration themselves; they describe how a setting should be
5//! displayed and where the current value came from.
6
7/// A rendered configuration section with key/value pairs.
8#[derive(Debug, Clone, PartialEq, Eq)]
9pub struct ConfigSection {
10 /// Human-readable section title.
11 pub title: String,
12 /// Rendered key/value entries for the section.
13 pub entries: Vec<(String, String)>,
14}
15
16/// A configuration value paired with its source.
17#[derive(Debug, Clone, PartialEq, Eq)]
18pub struct ConfigValue {
19 /// The resolved configuration value.
20 pub value: String,
21 /// Whether the value came from the environment or the config file.
22 pub source: ConfigValueSource,
23}
24
25/// The provenance of a resolved configuration value.
26#[derive(Debug, Clone, Copy, PartialEq, Eq)]
27pub enum ConfigValueSource {
28 /// Value came from an environment variable override.
29 Env,
30 /// Value came from the persisted config file.
31 File,
32}