diff --git a/mwbot_template.toml b/mwbot_template.toml index 84a3364..9a7d13f 100644 --- a/mwbot_template.toml +++ b/mwbot_template.toml @@ -4,5 +4,5 @@ rest_url = "{}" [auth] username = "{}" -password = "{}" -# oauth2_token = "{}" +# password = "{}" +oauth2_token = "{}" diff --git a/src/main.rs b/src/main.rs index 6b29d76..b8ff8ed 100644 --- a/src/main.rs +++ b/src/main.rs @@ -26,7 +26,7 @@ struct SetupArgs { username: String, /// Specify the botpassword of the bot #[arg(long, env = "MW_BOTPASSWORD")] - botpassword: String, + botpassword: Option, /// Specify the OAuth2 token of the bot #[arg(long, env = "MW_OAUTH2")] oauth2_token: String, @@ -52,7 +52,7 @@ fn read_config_template() -> Result { } 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.