refactor: adapters configured from config crate

This commit is contained in:
2026-10-25 21:07:19 +01:00
parent 1f724bb064
commit 04f9c13625
45 changed files with 277 additions and 177 deletions

View File

@@ -14,13 +14,13 @@ pub struct NatsConfig {
}
impl NatsConfig {
pub fn from_env() -> anyhow::Result<Self> {
pub fn from_config(config: &::config::NatsConfig) -> anyhow::Result<Self> {
Self::from_vars(
std::env::var("NATS_URL").ok().as_deref(),
std::env::var("NATS_MODE").ok().as_deref(),
std::env::var("NATS_SUBJECT_PREFIX").ok().as_deref(),
std::env::var("NATS_STREAM_NAME").ok().as_deref(),
std::env::var("NATS_CONSUMER_NAME").ok().as_deref(),
config.url.as_deref(),
Some(&config.mode),
Some(&config.subject_prefix),
Some(&config.stream_name),
Some(&config.consumer_name),
)
}