feat: Make OAuth2 token the default credential for authentification
This commit is contained in:
parent
8f779d005f
commit
d2c2f09ec3
@ -4,5 +4,5 @@ rest_url = "{}"
|
|||||||
|
|
||||||
[auth]
|
[auth]
|
||||||
username = "{}"
|
username = "{}"
|
||||||
password = "{}"
|
# password = "{}"
|
||||||
# oauth2_token = "{}"
|
oauth2_token = "{}"
|
||||||
|
@ -26,7 +26,7 @@ struct SetupArgs {
|
|||||||
username: String,
|
username: String,
|
||||||
/// Specify the botpassword of the bot
|
/// Specify the botpassword of the bot
|
||||||
#[arg(long, env = "MW_BOTPASSWORD")]
|
#[arg(long, env = "MW_BOTPASSWORD")]
|
||||||
botpassword: String,
|
botpassword: Option<String>,
|
||||||
/// Specify the OAuth2 token of the bot
|
/// Specify the OAuth2 token of the bot
|
||||||
#[arg(long, env = "MW_OAUTH2")]
|
#[arg(long, env = "MW_OAUTH2")]
|
||||||
oauth2_token: String,
|
oauth2_token: String,
|
||||||
@ -52,7 +52,7 @@ fn read_config_template() -> Result<String, std::io::Error> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn fill_config_template(config_template: String, args: SetupArgs) -> String {
|
fn fill_config_template(config_template: String, args: SetupArgs) -> String {
|
||||||
formatx!(config_template, args.api_url, args.rest_url, args.username, args.botpassword, args.oauth2_token).unwrap()
|
formatx!(config_template, args.api_url, args.rest_url, args.username, args.botpassword.unwrap_or("".into()), args.oauth2_token).unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fix permissions on UNIX-like systems, since mwbot-rs doesn't like to read configs with loose permissions.
|
// Fix permissions on UNIX-like systems, since mwbot-rs doesn't like to read configs with loose permissions.
|
||||||
|
Loading…
Reference in New Issue
Block a user