Bootstrap fixes

This commit is contained in:
Maurus Decimus
2026-04-18 20:52:36 +02:00
parent 7209c5fc06
commit 0b17080f1f
4 changed files with 26 additions and 27 deletions

View File

@@ -47,13 +47,13 @@ impl BootstrapDefaults for Bootstrap {
}
async fn insert_safe_defaults(bp: &mut Bootstrap) -> trc::Result<()> {
if bp.registry.is_recovery_mode() {
return Ok(());
}
let is_recovery_mode = bp.registry.is_recovery_mode();
let is_bootstrap_mode = bp.registry.is_bootstrap_mode();
#[cfg(not(feature = "test_mode"))]
if bp.registry.count_object(ObjectType::Application).await? == 0 {
bp.registry
if !is_recovery_mode || is_bootstrap_mode {
if bp.registry.count_object(ObjectType::Application).await? == 0 {
bp.registry
.write(RegistryWrite::insert(
&Application {
auto_update_frequency: Duration::from_millis(30 * 24 * 60 * 60 * 1000),
@@ -71,9 +71,10 @@ async fn insert_safe_defaults(bp: &mut Bootstrap) -> trc::Result<()> {
.into(),
))
.await?;
}
}
if bp.registry.is_bootstrap_mode() {
if is_bootstrap_mode {
#[cfg(not(any(feature = "dev_mode", feature = "test_mode")))]
if bp.registry.count_object(ObjectType::SystemSettings).await? == 0 {
bp.registry
@@ -90,6 +91,10 @@ async fn insert_safe_defaults(bp: &mut Bootstrap) -> trc::Result<()> {
return Ok(());
}
if is_recovery_mode {
return Ok(());
}
if bp.registry.count_object(ObjectType::MtaQueueQuota).await? == 0 {
bp.registry
.write(RegistryWrite::insert(

View File

@@ -5,10 +5,13 @@
*/
use crate::registry::{
mapping::{RegistryGetResponse, RegistrySetResponse},
mapping::{RegistryGetResponse, RegistrySetResponse, map_bootstrap_error},
set::map_write_error,
};
use common::{DATABASE_SCHEMA_VERSION, Server, network::acme::account::acme_create_account, psl};
use common::{
DATABASE_SCHEMA_VERSION, Server, config::storage::Storage,
network::acme::account::acme_create_account, psl,
};
use directory::core::secret::hash_secret;
use jmap_proto::error::set::{SetError, SetErrorType};
use jmap_tools::{JsonPointer, JsonPointerItem, Key};
@@ -244,6 +247,15 @@ pub(crate) async fn bootstrap_set(
}
}
}
let mut bp_check =
store::registry::bootstrap::Bootstrap::new_uninitialized(tmp_registry.clone());
let _ = Storage::parse(&mut bp_check).await;
if !bp_check.errors.is_empty() {
set.response
.not_updated
.append(id, map_bootstrap_error(bp_check.errors));
break 'outer;
}
// Create inner store
let registry =

View File

@@ -37939,7 +37939,7 @@ impl Default for TracerLog {
path: Default::default(),
prefix: "stalwart".to_string(),
rotate: LogRotateFrequency::Daily,
ansi: false,
ansi: true,
multiline: false,
enable: true,
level: TracingLevel::Info,

View File

@@ -1,18 +0,0 @@
#!/bin/bash
export URL="https://127.0.0.1:443" CREDENTIALS="admin:secret"
cargo run -p stalwart-cli -- domain create example.org
cargo run -p stalwart-cli -- account create john 12345 -d "John Doe" -a john@example.org -a john.doe@example.org
cargo run -p stalwart-cli -- account create jane abcde -d "Jane Doe" -a jane@example.org
cargo run -p stalwart-cli -- account create bill xyz12 -d "Bill Foobar" -a bill@example.org
cargo run -p stalwart-cli -- group create sales -d "Sales Department"
cargo run -p stalwart-cli -- group create support -d "Technical Support"
cargo run -p stalwart-cli -- account add-to-group john sales support
cargo run -p stalwart-cli -- account remove-from-group john support
cargo run -p stalwart-cli -- account add-email jane jane.doe@example.org
cargo run -p stalwart-cli -- list create everyone everyone@example.org
cargo run -p stalwart-cli -- list add-members everyone jane john bill
cargo run -p stalwart-cli -- account list
cargo run -p stalwart-cli -- import messages --format mbox john _ignore/dovecot-crlf
cargo run -p stalwart-cli -- import messages --format maildir john /var/mail/john