Skip to content

Commit

Permalink
Make initial admin password configurable via env (#311)
Browse files Browse the repository at this point in the history
This is useful for running Stalwart in Docker or packaging it for certain systems
  • Loading branch information
AaronDewes authored Apr 10, 2024
1 parent a4e3b1e commit c4b0493
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions crates/common/src/manager/boot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,11 +293,13 @@ fn quickstart(path: impl Into<PathBuf>) {
}
}

let admin_pass = thread_rng()
.sample_iter(Alphanumeric)
.take(10)
.map(char::from)
.collect::<String>();
let admin_pass = std::env::var("STALWART_INITIAL_ADMIN_PASSWORD").unwrap_or_else(|_| {
thread_rng()
.sample_iter(Alphanumeric)
.take(10)
.map(char::from)
.collect::<String>()
});

std::fs::write(
path.join("etc").join("config.toml"),
Expand Down

0 comments on commit c4b0493

Please sign in to comment.