fix: remove proxy and add top-level err msg

This commit is contained in:
Matthieu Bessat 2023-12-28 13:25:25 +01:00
parent 0f15e64ba2
commit 4184a0624c
4 changed files with 26 additions and 5 deletions

10
TODO.md
View File

@ -16,3 +16,13 @@ all of the normalization work should not have been done here,
we should have created our own platform so people can register and pay later (either in cash, or using 3rd party payment like stripe)
## 2023-12-28
TODO:
- more configuration options
- configurable proxy
- summary of the operations at the end of run
- how many users were added, muted?
- conjoined user: add attached member to paheko
- "Membre lié"
- is this kind of thing even accessible on the API-level ?

View File

@ -53,9 +53,10 @@ impl Client {
// decoy user agent
default_headers.insert("User-Agent", "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/112.0".parse().unwrap());
let proxy = reqwest::Proxy::https("https://localhost:8999").unwrap();
// TODO: configurable proxy
// let proxy = reqwest::Proxy::https("https://localhost:8999").unwrap();
reqwest::Client::builder()
.proxy(proxy)
// .proxy(proxy)
.default_headers(default_headers)
}

View File

@ -407,5 +407,14 @@ async fn launch_adapter() -> Result<()> {
#[tokio::main]
async fn main() {
// TODO: add argument parser to have handle config file
let _res = launch_adapter().await;
let res = launch_adapter().await;
match res {
Err(err) => {
eprintln!("Program failed, details bellow");
eprintln!("{:?}", err);
},
Ok(()) => {
eprintln!("Program done");
}
}
}

View File

@ -156,10 +156,11 @@ impl Client {
fn get_base_client_builder() -> reqwest::ClientBuilder {
let mut default_headers = reqwest::header::HeaderMap::new();
default_headers.insert("Accept", "application/json".parse().unwrap());
default_headers.insert("User-Agent", "helloasso_paheko_adapter".parse().unwrap());
let proxy = reqwest::Proxy::http("http://localhost:8998").unwrap();
// let proxy = reqwest::Proxy::http("http://localhost:8998").unwrap();
reqwest::Client::builder()
.proxy(proxy)
// .proxy(proxy)
.default_headers(default_headers)
}