Make initial admin password configurable via env (#311)

This is useful for running Stalwart in Docker or packaging it for certain systems
This commit is contained in:
Aaron Dewes
2024-04-10 09:56:33 +02:00
committed by GitHub
parent a4e3b1edeb
commit c4b0493fdc

View File

@@ -293,11 +293,13 @@ fn quickstart(path: impl Into<PathBuf>) {
} }
} }
let admin_pass = thread_rng() let admin_pass = std::env::var("STALWART_INITIAL_ADMIN_PASSWORD").unwrap_or_else(|_| {
.sample_iter(Alphanumeric) thread_rng()
.take(10) .sample_iter(Alphanumeric)
.map(char::from) .take(10)
.collect::<String>(); .map(char::from)
.collect::<String>()
});
std::fs::write( std::fs::write(
path.join("etc").join("config.toml"), path.join("etc").join("config.toml"),