Skip to content

Commit

Permalink
feat: update logdna client
Browse files Browse the repository at this point in the history
  • Loading branch information
christopher-besch committed Aug 27, 2024
1 parent a7c65ef commit 7e26552
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 2 deletions.
2 changes: 1 addition & 1 deletion mock/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ pub async fn mock_server(cfg: TestCfg) {
println!("{}", *proc_count.lock().unwrap());
assert_eq!(
body.lines[0].line,
Some(format!("Critical docker_logdna error: Failed to send line to logdna ({}/5 retries): connection closed before message completed", *proc_count.lock().unwrap() / 2))
Some(format!("Critical docker_logdna error: Failed to send line to logdna ({}/5 retries): client error (SendRequest)", *proc_count.lock().unwrap() / 2))
);
if *proc_count.lock().unwrap() == 11 {
inner_notify_stop.notify_one();
Expand Down
34 changes: 34 additions & 0 deletions plugin/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,40 @@
"entrypoint": [
"/docker_logdna"
],
"env": [
{
"Description": "",
"Name": "HTTP_PROXY",
"Settable": [
"value"
],
"Value": ""
},
{
"Description": "",
"Name": "HTTPS_PROXY",
"Settable": [
"value"
],
"Value": ""
},
{
"Description": "",
"Name": "http_proxy",
"Settable": [
"value"
],
"Value": ""
},
{
"Description": "",
"Name": "https_proxy",
"Settable": [
"value"
],
"Value": ""
}
],
"network": {
"type": "host"
},
Expand Down
5 changes: 4 additions & 1 deletion src/get_container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,10 @@ pub async fn get_client(config: &Config) -> Result<Client, String> {
};

// require_tls needs to be set to Some(false) for http to be used (required for the mocking server)
let mut client = Client::new(template, Some(!config.for_mock_server));
let mut client = match Client::new(template, Some(!config.for_mock_server)) {
Ok(client) => client,
Err(e) => return Err(format!("Failed to build the client. {}", e)),
};
client.set_timeout(config.http_client_timeout);
Ok(client)
}

0 comments on commit 7e26552

Please sign in to comment.