Remove auth CLI argument and use user + pass instead
This commit is contained in:
parent
82140410d6
commit
0ff3d0f7d0
1 changed files with 6 additions and 26 deletions
|
@ -7,17 +7,6 @@ mod version;
|
||||||
|
|
||||||
use clap::{Arg, Command};
|
use clap::{Arg, Command};
|
||||||
|
|
||||||
fn auth_valid(v: &str) -> Result<(), String> {
|
|
||||||
if v.contains(':') {
|
|
||||||
return Ok(());
|
|
||||||
}
|
|
||||||
Err(String::from(
|
|
||||||
"\
|
|
||||||
Provide a valid user:pass value separated by a colon, \
|
|
||||||
or use the --auth-user and --auth-pass flags\
|
|
||||||
",
|
|
||||||
))
|
|
||||||
}
|
|
||||||
|
|
||||||
fn file_valid(v: &str) -> Result<(), String> {
|
fn file_valid(v: &str) -> Result<(), String> {
|
||||||
if !v.is_empty() {
|
if !v.is_empty() {
|
||||||
|
@ -138,33 +127,24 @@ pub fn init() {
|
||||||
.help("Database path used for storing data"),
|
.help("Database path used for storing data"),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new("auth")
|
Arg::new("user")
|
||||||
.short('a')
|
|
||||||
.long("auth")
|
|
||||||
.forbid_empty_values(true)
|
|
||||||
.validator(auth_valid)
|
|
||||||
.default_value("root:root")
|
|
||||||
.help("Master database authentication details"),
|
|
||||||
)
|
|
||||||
.arg(
|
|
||||||
Arg::new("auth-user")
|
|
||||||
.short('u')
|
.short('u')
|
||||||
.long("auth-user")
|
.long("user")
|
||||||
.forbid_empty_values(true)
|
.forbid_empty_values(true)
|
||||||
.default_value("root")
|
.default_value("root")
|
||||||
.help("The master username for the database"),
|
.help("The master username for the database"),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new("auth-pass")
|
Arg::new("pass")
|
||||||
.short('p')
|
.short('p')
|
||||||
.long("auth-pass")
|
.long("pass")
|
||||||
.forbid_empty_values(true)
|
.forbid_empty_values(true)
|
||||||
.default_value("root")
|
.default_value("root")
|
||||||
.help("The master password for the database"),
|
.help("The master password for the database"),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new("auth-addr")
|
Arg::new("addr")
|
||||||
.long("auth-addr")
|
.long("addr")
|
||||||
.number_of_values(1)
|
.number_of_values(1)
|
||||||
.forbid_empty_values(true)
|
.forbid_empty_values(true)
|
||||||
.multiple_occurrences(true)
|
.multiple_occurrences(true)
|
||||||
|
|
Loading…
Reference in a new issue