When unset, ensure default root password in randomised
This commit is contained in:
parent
0ff3d0f7d0
commit
f7b82bc7bd
3 changed files with 9 additions and 1 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -2255,6 +2255,7 @@ dependencies = [
|
|||
"hyper",
|
||||
"log",
|
||||
"once_cell",
|
||||
"rand 0.8.5",
|
||||
"reqwest",
|
||||
"rmp-serde",
|
||||
"serde",
|
||||
|
|
|
@ -25,6 +25,7 @@ http = "0.2.7"
|
|||
hyper = "0.14.18"
|
||||
log = "0.4.17"
|
||||
once_cell = "1.10.0"
|
||||
rand = "0.8.5"
|
||||
reqwest = { version = "0.11.10", features = ["blocking"] }
|
||||
serde = { version = "1.0.137", features = ["derive"] }
|
||||
serde_cbor = "0.11.2"
|
||||
|
|
|
@ -6,7 +6,13 @@ mod start;
|
|||
mod version;
|
||||
|
||||
use clap::{Arg, Command};
|
||||
use once_cell::sync::Lazy;
|
||||
use rand::distributions::Alphanumeric;
|
||||
use rand::Rng;
|
||||
|
||||
static PASS: Lazy<String> = Lazy::new(|| {
|
||||
rand::thread_rng().sample_iter(&Alphanumeric).take(128).map(char::from).collect::<String>()
|
||||
});
|
||||
|
||||
fn file_valid(v: &str) -> Result<(), String> {
|
||||
if !v.is_empty() {
|
||||
|
@ -139,7 +145,7 @@ pub fn init() {
|
|||
.short('p')
|
||||
.long("pass")
|
||||
.forbid_empty_values(true)
|
||||
.default_value("root")
|
||||
.default_value(PASS.as_str())
|
||||
.help("The master password for the database"),
|
||||
)
|
||||
.arg(
|
||||
|
|
Loading…
Reference in a new issue