Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions crates/defguard_common/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ pub struct DefGuardConfig {
#[serde(skip_serializing)]
pub openid_signing_key: Option<RsaPrivateKey>,

#[arg(long, env = "DEFGUARD_URL", value_parser = Url::parse, default_value = "http://localhost:8000")]
#[arg(long, env = "DEFGUARD_URL", value_parser = Url::parse)]
#[serde(skip_serializing)]
#[deprecated(since = "2.0.0", note = "Use Settings.defguard_url instead")]
pub url: Url,
pub url: Option<Url>,

#[arg(long, env = "DEFGUARD_DISABLE_STATS_PURGE")]
#[deprecated(since = "2.0.0", note = "Use Settings.enable_stats_purge instead")]
Expand Down
3 changes: 3 additions & 0 deletions crates/defguard_common/src/db/models/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -721,6 +721,9 @@ impl Settings {
let hour = minute * 60;
let day = hour * 24;

if let Some(url) = &config.url {
self.defguard_url = url.to_string();
}
if let Some(secret_key) = &config.secret_key {
let secret_key = secret_key.expose_secret();
if let Err(err) = Settings::validate_secret_key(secret_key) {
Expand Down
2 changes: 1 addition & 1 deletion crates/defguard_core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,7 @@ pub async fn init_dev_env(config: &DefGuardConfig) {
.clone()
.unwrap_or(Url::parse("http://127.0.0.1:8000").unwrap())
.to_string();
settings.defguard_url = config.url.to_string();
settings.defguard_url = config.url.clone().unwrap().to_string();
update_current_settings(&pool, settings)
.await
.expect("Failed to update settings");
Expand Down
Loading