diff --git a/crates/defguard/src/main.rs b/crates/defguard/src/main.rs index 8ae32950b7..246f1c0ea6 100644 --- a/crates/defguard/src/main.rs +++ b/crates/defguard/src/main.rs @@ -117,6 +117,7 @@ async fn main() -> Result<(), anyhow::Error> { let wizard = Wizard::init(&pool, has_auto_adopt_flags).await?; let mut ini_server_config = true; + Settings::initialize_runtime_defaults(&pool).await?; if !wizard.completed { match wizard.active_wizard { ActiveWizard::None => {} @@ -136,9 +137,6 @@ async fn main() -> Result<(), anyhow::Error> { ActiveWizard::Migration => { let mut settings = Settings::get_current_settings(); settings.update_from_config(&pool, &config).await?; - - Settings::initialize_runtime_defaults(&pool).await?; - config.initialize_post_settings(); SERVER_CONFIG .set(config.clone()) @@ -159,8 +157,6 @@ async fn main() -> Result<(), anyhow::Error> { } } - Settings::initialize_runtime_defaults(&pool).await?; - if ini_server_config { config.initialize_post_settings(); diff --git a/crates/defguard_common/src/db/models/settings.rs b/crates/defguard_common/src/db/models/settings.rs index 8a7175d839..4849730435 100644 --- a/crates/defguard_common/src/db/models/settings.rs +++ b/crates/defguard_common/src/db/models/settings.rs @@ -51,7 +51,7 @@ pub async fn update_current_settings<'e, E: sqlx::PgExecutor<'e>>( pub enum SettingsValidationError { #[error("Cannot enable gateway disconnect notifications. SMTP is not configured")] CannotEnableGatewayNotifications, - #[error("Invalid defguard_url `{0}`")] + #[error("Invalid defguard_url `{0}`, url has to be a domain, not IP")] InvalidDefguardUrl(String), } diff --git a/crates/defguard_gateway_manager/src/tests/gateway_manager/handler/support.rs b/crates/defguard_gateway_manager/src/tests/gateway_manager/handler/support.rs index dab5e580d6..5a2b56a1ad 100644 --- a/crates/defguard_gateway_manager/src/tests/gateway_manager/handler/support.rs +++ b/crates/defguard_gateway_manager/src/tests/gateway_manager/handler/support.rs @@ -10,13 +10,15 @@ use defguard_common::db::{ }, }; use defguard_core::grpc::GatewayEvent; -use defguard_proto::enterprise::firewall::{ - FirewallConfig, FirewallPolicy, FirewallRule, IpAddress, IpVersion, Port, Protocol, - SnatBinding, ip_address::Address, port::Port as PortInner, -}; -use defguard_proto::gateway::{ - CoreResponse, Update, UpdateType, core_response, - update::{self}, +use defguard_proto::{ + enterprise::firewall::{ + FirewallConfig, FirewallPolicy, FirewallRule, IpAddress, IpVersion, Port, Protocol, + SnatBinding, ip_address::Address, port::Port as PortInner, + }, + gateway::{ + CoreResponse, Update, UpdateType, core_response, + update::{self}, + }, }; use sqlx::postgres::PgConnectOptions;