Bootstrap fixes
This commit is contained in:
@@ -47,13 +47,13 @@ impl BootstrapDefaults for Bootstrap {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fn insert_safe_defaults(bp: &mut Bootstrap) -> trc::Result<()> {
|
async fn insert_safe_defaults(bp: &mut Bootstrap) -> trc::Result<()> {
|
||||||
if bp.registry.is_recovery_mode() {
|
let is_recovery_mode = bp.registry.is_recovery_mode();
|
||||||
return Ok(());
|
let is_bootstrap_mode = bp.registry.is_bootstrap_mode();
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(not(feature = "test_mode"))]
|
#[cfg(not(feature = "test_mode"))]
|
||||||
if bp.registry.count_object(ObjectType::Application).await? == 0 {
|
if !is_recovery_mode || is_bootstrap_mode {
|
||||||
bp.registry
|
if bp.registry.count_object(ObjectType::Application).await? == 0 {
|
||||||
|
bp.registry
|
||||||
.write(RegistryWrite::insert(
|
.write(RegistryWrite::insert(
|
||||||
&Application {
|
&Application {
|
||||||
auto_update_frequency: Duration::from_millis(30 * 24 * 60 * 60 * 1000),
|
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(),
|
.into(),
|
||||||
))
|
))
|
||||||
.await?;
|
.await?;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if bp.registry.is_bootstrap_mode() {
|
if is_bootstrap_mode {
|
||||||
#[cfg(not(any(feature = "dev_mode", feature = "test_mode")))]
|
#[cfg(not(any(feature = "dev_mode", feature = "test_mode")))]
|
||||||
if bp.registry.count_object(ObjectType::SystemSettings).await? == 0 {
|
if bp.registry.count_object(ObjectType::SystemSettings).await? == 0 {
|
||||||
bp.registry
|
bp.registry
|
||||||
@@ -90,6 +91,10 @@ async fn insert_safe_defaults(bp: &mut Bootstrap) -> trc::Result<()> {
|
|||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if is_recovery_mode {
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
|
||||||
if bp.registry.count_object(ObjectType::MtaQueueQuota).await? == 0 {
|
if bp.registry.count_object(ObjectType::MtaQueueQuota).await? == 0 {
|
||||||
bp.registry
|
bp.registry
|
||||||
.write(RegistryWrite::insert(
|
.write(RegistryWrite::insert(
|
||||||
|
|||||||
@@ -5,10 +5,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
use crate::registry::{
|
use crate::registry::{
|
||||||
mapping::{RegistryGetResponse, RegistrySetResponse},
|
mapping::{RegistryGetResponse, RegistrySetResponse, map_bootstrap_error},
|
||||||
set::map_write_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 directory::core::secret::hash_secret;
|
||||||
use jmap_proto::error::set::{SetError, SetErrorType};
|
use jmap_proto::error::set::{SetError, SetErrorType};
|
||||||
use jmap_tools::{JsonPointer, JsonPointerItem, Key};
|
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
|
// Create inner store
|
||||||
let registry =
|
let registry =
|
||||||
|
|||||||
@@ -37939,7 +37939,7 @@ impl Default for TracerLog {
|
|||||||
path: Default::default(),
|
path: Default::default(),
|
||||||
prefix: "stalwart".to_string(),
|
prefix: "stalwart".to_string(),
|
||||||
rotate: LogRotateFrequency::Daily,
|
rotate: LogRotateFrequency::Daily,
|
||||||
ansi: false,
|
ansi: true,
|
||||||
multiline: false,
|
multiline: false,
|
||||||
enable: true,
|
enable: true,
|
||||||
level: TracingLevel::Info,
|
level: TracingLevel::Info,
|
||||||
|
|||||||
@@ -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
|
|
||||||
Reference in New Issue
Block a user