feat: Add ability to set up API and REST URLs
This commit is contained in:
parent
2fcbe535b9
commit
c22af9bedf
@ -1,6 +1,6 @@
|
|||||||
# Copy this to `~/.config/mwbot.toml`.
|
# Copy this to `~/.config/mwbot.toml`.
|
||||||
api_url = "https://en.wiktionary.org/w/api.php"
|
api_url = "{}"
|
||||||
rest_url = "https://en.wiktionary.org/api/rest_v1"
|
rest_url = "{}"
|
||||||
|
|
||||||
[auth]
|
[auth]
|
||||||
username = "{}"
|
username = "{}"
|
||||||
|
@ -41,7 +41,7 @@ fn setup(action: Action) -> Result<(), std::io::Error> {
|
|||||||
match action {
|
match action {
|
||||||
Action::Run => {panic!();}
|
Action::Run => {panic!();}
|
||||||
Action::Setup { username, botpassword, oauth2_token, api_url, rest_url } => {
|
Action::Setup { username, botpassword, oauth2_token, api_url, rest_url } => {
|
||||||
let filled_in_config = formatx!(config_template, username, botpassword, oauth2_token).unwrap();
|
let filled_in_config = formatx!(config_template, api_url, rest_url, username, botpassword, oauth2_token).unwrap();
|
||||||
std::fs::write(shellexpand::tilde("~/.config/mwbot.toml").into_owned(), filled_in_config).unwrap();
|
std::fs::write(shellexpand::tilde("~/.config/mwbot.toml").into_owned(), filled_in_config).unwrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user