feat: hot-reloading of config file

This commit is contained in:
Jun Kurihara 2023-07-23 01:42:39 +09:00
commit 58e22d33af
No known key found for this signature in database
GPG key ID: 6D3FEE70E498C15B
16 changed files with 213 additions and 58 deletions

View file

@ -25,19 +25,19 @@ pub mod reexports {
/// Entrypoint that creates and spawns tasks of reverse proxy services
pub async fn entrypoint<T>(
proxy_config: ProxyConfig,
app_config_list: AppConfigList<T>,
runtime_handle: tokio::runtime::Handle,
proxy_config: &ProxyConfig,
app_config_list: &AppConfigList<T>,
runtime_handle: &tokio::runtime::Handle,
) -> Result<()>
where
T: CryptoSource + Clone + Send + Sync + 'static,
{
// build global
let globals = Arc::new(Globals {
proxy_config,
backends: app_config_list.try_into()?,
proxy_config: proxy_config.clone(),
backends: app_config_list.clone().try_into()?,
request_count: Default::default(),
runtime_handle,
runtime_handle: runtime_handle.clone(),
});
// let connector = TrustDnsResolver::default().into_rustls_webpki_https_connector();
let connector = hyper_rustls::HttpsConnectorBuilder::new()
@ -71,8 +71,8 @@ where
}));
// wait for all future
if let (Ok(_), _, _) = futures.await {
error!("Some proxy services are down");
if let (Ok(Err(e)), _, _) = futures.await {
error!("Some proxy services are down: {:?}", e);
};
Ok(())