@startuml
title Before: Direct YAML Parse + Ad Hoc Env Reads
skinparam backgroundColor #FAFAFA
skinparam componentStyle rectangle
skinparam defaultFontName Consolas

package "Startup" #E8F1FF {
  component "load_server_config_file()" as load
  component "serde_yaml::from_str" as parse
  component "ServerConfigFile" as cfg
}

package "Runtime Config Merge" #FFF4E6 {
  component "load_config()" as runtime
  component "BASE_URL/AUTH_BASE_PATH\nread with per-field fallback" as env1
  component "TRUSTED_ORIGINS\nmerged with YAML list" as env2
}

package "Gaps" #FFE8E8 {
  component "No generic key traversal" as gap1
  component "No ${ENV} / ${ENV:-default}\ninline template support" as gap2
  component "No unified env override convention\nfor every YAML key" as gap3
}

database "Environment" as env
file "config.yaml" as yaml

yaml --> load
load --> parse
parse --> cfg
cfg --> runtime
env --> env1
env --> env2

runtime --> gap1
runtime --> gap2
runtime --> gap3

note bottom of runtime
Precedence was inconsistent:
- some fields YAML-first
- some fields env-then-YAML merge
end note
@enduml
