Skip to content

Commit

Permalink
Add proxy configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
rokob committed May 1, 2019
1 parent f7d7eb3 commit 6754e09
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 15 deletions.
2 changes: 1 addition & 1 deletion builder_derive/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "builder_derive"
version = "0.1.0"
version = "0.1.1"
authors = ["Andrew Weiss <[email protected]>"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rollbar-rust"
version = "0.1.0"
version = "0.1.1"
authors = ["Andrew Weiss <[email protected]>"]
edition = "2018"

Expand Down
2 changes: 2 additions & 0 deletions core/src/configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ pub struct Configuration {
pub code_version: Option<String>,
pub log_level: Level,
pub timeout: u64,
pub proxy: Option<String>,
}

impl Default for Configuration {
Expand All @@ -22,6 +23,7 @@ impl Default for Configuration {
code_version: None,
log_level: Level::Info,
timeout: 10,
proxy: None,
}
}
}
14 changes: 9 additions & 5 deletions core/src/transport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::time::Duration;

use crate::configuration::Configuration;
use crate::types::Item;
use reqwest::Client;
use reqwest::{Client, Proxy};

const QUEUE_DEPTH: usize = 50;

Expand All @@ -32,11 +32,15 @@ impl HttpTransport {
let (tx, rx) = sync_channel(QUEUE_DEPTH);
let signal = Arc::new(Condvar::new());
let shutdown = Arc::new(AtomicBool::new(false));
let client = Client::builder()
let client_builder = Client::builder()
.gzip(true)
.timeout(Duration::from_secs(configuration.timeout))
.build()
.unwrap();
.timeout(Duration::from_secs(configuration.timeout));
let client_builder = if let Some(proxy) = &configuration.proxy {
client_builder.proxy(Proxy::all(proxy).unwrap())
} else {
client_builder
};
let client = client_builder.build().unwrap();
#[allow(clippy::mutex_atomic)]
let queue_depth = Arc::new(Mutex::new(0));
let endpoint = configuration.endpoint.clone();
Expand Down
2 changes: 1 addition & 1 deletion jvm_bare_agent/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rollbar-jvm-agent"
version = "0.1.0"
version = "0.1.1"
authors = ["Andrew Weiss <[email protected]>"]
edition = "2018"

Expand Down
4 changes: 2 additions & 2 deletions jvm_bare_agent/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ use rollbar_jvm::jvmti::*;
use rollbar_rust::Configuration;
use std::env;
use std::os::raw::{c_char, c_void};
use std::sync::atomic::{AtomicBool, Ordering, ATOMIC_BOOL_INIT};
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::Once;

static INIT_SUCCESS: AtomicBool = ATOMIC_BOOL_INIT;
static INIT_SUCCESS: AtomicBool = AtomicBool::new(false);

static mut CONFIG: Option<Configuration> = None;
static INIT: Once = Once::new();
Expand Down
2 changes: 1 addition & 1 deletion jvm_core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rollbar-jvm"
version = "0.1.0"
version = "0.1.1"
authors = ["Andrew Weiss <[email protected]>"]
build = "build.rs"
edition = "2018"
Expand Down
2 changes: 1 addition & 1 deletion jvm_sdk_agent/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rollbar-java-agent"
version = "0.1.0"
version = "0.1.1"
authors = ["Andrew Weiss <[email protected]>"]
edition = "2018"

Expand Down
4 changes: 2 additions & 2 deletions jvm_sdk_agent/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ use rollbar_jvm::env::JvmTiEnv;
use rollbar_jvm::jni::JniEnv;
use rollbar_jvm::jvmti::{jint, jlocation, jmethodID, jobject, jthread, jvmtiEnv, JNIEnv, JavaVM};
use std::os::raw::{c_char, c_void};
use std::sync::atomic::{AtomicBool, Ordering, ATOMIC_BOOL_INIT};
use std::sync::atomic::{AtomicBool, Ordering};

static INIT_SUCCESS: AtomicBool = ATOMIC_BOOL_INIT;
static INIT_SUCCESS: AtomicBool = AtomicBool::new(false);

/// This is the Agent entry point that is called by the JVM during the loading phase.
/// Any failures in this function will cause the JVM not to start which is strictly
Expand Down
2 changes: 1 addition & 1 deletion pyagent/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pyagent"
version = "0.1.0"
version = "0.1.1"
authors = ["Andrew Weiss <[email protected]>"]
edition = "2018"

Expand Down

0 comments on commit 6754e09

Please sign in to comment.