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