refactor: adapters configured from config crate
This commit is contained in:
@@ -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),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user