Skip to content

Commit

Permalink
Update version to 0.1.2 in Cargo.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
Aitthi committed Sep 30, 2024
1 parent 5b72e6b commit be574f7
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "easy-proxy"
version = "0.1.1"
version = "0.1.2"
edition = "2021"

[dependencies]
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ pingora:
# upgrade_sock: /tmp/pingora_upgrade.sock
# user: nobody
# group: webusers
# grace_period_seconds: 1
# graceful_shutdown_timeout_seconds: 1
# ca_file: /etc/ssl/certs/ca-certificates.crt
```

Expand Down
2 changes: 2 additions & 0 deletions src/config/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ pub struct Pingora {
pub group: Option<String>,
pub ca_file: Option<String>,
pub upstream_keepalive_pool_size: Option<usize>,
pub grace_period_seconds: Option<u64>,
pub graceful_shutdown_timeout_seconds: Option<u64>,
}

// Initialize global configuration
Expand Down
23 changes: 23 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,29 @@ fn main() {
}
}

let conf = config::runtime::config();
let http = &conf.proxy.http;
let https = &conf.proxy.https;

// check if the proxy is running
match std::net::TcpListener::bind(http) {
Ok(_) => {}
Err(e) => {
tracing::error!("An error occurred while trying to bind to {}: {}", http, e);
std::process::exit(1);
}
};
match https {
Some(https) => match std::net::TcpListener::bind(https) {
Ok(_) => {}
Err(e) => {
tracing::error!("An error occurred while trying to bind to {}: {}", https, e);
std::process::exit(1);
}
},
None => {}
}

let rt = tokio::runtime::Runtime::new()
.map_err(|e| tracing::error!("Error: {:?}", e))
.unwrap();
Expand Down
2 changes: 2 additions & 0 deletions src/proxy/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ impl EasyProxy {
if let Some(upstream_keepalive_pool_size) = app_conf.pingora.upstream_keepalive_pool_size {
conf.upstream_keepalive_pool_size = upstream_keepalive_pool_size;
}
conf.grace_period_seconds = conf.grace_period_seconds.or(Some(1));
conf.graceful_shutdown_timeout_seconds = conf.graceful_shutdown_timeout_seconds.or(Some(1));
pingora_server.configuration = conf.into();
pingora_server.bootstrap();
let mut pingora_svc =
Expand Down

0 comments on commit be574f7

Please sign in to comment.