Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Market - configurable (ENV) offer expiration (to enable tests) #1252

Merged
merged 3 commits into from
Apr 23, 2021
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions core/market/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ pub struct DiscoveryConfig {
pub mean_cyclic_unsubscribes_interval: Duration,
}

#[derive(StructOpt)]
pub struct SubscriptionConfig {
#[structopt(env = "DEFAULT_SUBSCRIPTION_TTL", parse(try_from_str = parse_chrono_duration), default_value = "1h")]
pub default_ttl: chrono::Duration,
}

Expand Down Expand Up @@ -68,3 +70,7 @@ impl Default for EventsConfig {
}
}
}

fn parse_chrono_duration(s: &str) -> Result<chrono::Duration, anyhow::Error> {
Ok(chrono::Duration::from_std(humantime::parse_duration(s)?)?)
}