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:
@@ -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"),
|
||||
|
||||
Reference in New Issue
Block a user