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
8 changes: 2 additions & 6 deletions crates/defguard/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ async fn main() -> Result<(), anyhow::Error> {
settings = Settings::get_current_settings();
} else if wizard_flags.migration_wizard_in_progress && !wizard_flags.migration_wizard_completed
{
settings.update_from_config(&pool, &config).await?;

config.initialize_post_settings();
SERVER_CONFIG
.set(config.clone())
Expand All @@ -128,12 +130,6 @@ async fn main() -> Result<(), anyhow::Error> {
settings = Settings::get_current_settings();
}

if wizard_flags.migration_wizard_needed {
info!("Migration from 1.6: copying configuration options to DB");
settings.update_from_config(&pool, &config).await?;
info!("Migration from 1.6: copied configuration options to DB");
}

if ini_server_config {
config.initialize_post_settings();

Expand Down
6 changes: 5 additions & 1 deletion crates/defguard_common/src/db/models/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,7 @@ impl Settings {
where
E: PgExecutor<'e>,
{
info!("Updating Settings from DefguardConfig: {config:?}");
let minute = 60;
let hour = minute * 60;
let day = hour * 24;
Expand Down Expand Up @@ -738,7 +739,10 @@ impl Settings {
self.password_reset_session_timeout_minutes =
(password_reset_session_timeout.as_secs() / minute) as i32;
}
update_current_settings(executor, self.clone()).await
update_current_settings(executor, self.clone()).await?;

info!("Updated Settings from DefguardConfig: {config:?}");
Ok(())
}
}

Expand Down