Skip to main content

suno_core/
config.rs

1//! Configuration model and precedence resolution.
2//!
3//! Parses a TOML string and merges in environment variables and CLI flag
4//! overrides supplied by the caller. Performs no disk or environment IO.
5//!
6//! [`shape`] holds the parsed input types and their validation, [`resolve`]
7//! layers the precedence tiers into [`EffectiveSettings`], and [`effective`]
8//! is the resolved output. [`label_to_env`] is the shared env-prefix rule both
9//! the validator and the resolver use.
10
11mod effective;
12mod resolve;
13mod shape;
14
15#[cfg(feature = "schema")]
16mod schema;
17
18#[cfg(test)]
19mod fixtures;
20
21pub use effective::{EffectiveSettings, FlagOverrides, animated_covers_flag_overridden};
22#[cfg(feature = "schema")]
23pub use schema::config_schema_json;
24pub use shape::{AccountConfig, AreaMode, AreasConfig, Config, Defaults, Settings, SourceConfig};
25
26/// Convert an account label to its environment variable prefix, mirroring the
27/// per-account keys the resolver reads: `my-lib` becomes `MY_LIB` for lookups
28/// like `SUNO_MY_LIB_TOKEN`.
29pub fn label_to_env(label: &str) -> String {
30    label.to_ascii_uppercase().replace('-', "_")
31}