diff --git a/rpxy-bin/src/config/parse.rs b/rpxy-bin/src/config/parse.rs index 109dc4b..09b24b3 100644 --- a/rpxy-bin/src/config/parse.rs +++ b/rpxy-bin/src/config/parse.rs @@ -80,15 +80,15 @@ pub fn build_settings() -> std::result::Result<(ProxyConfig, AppConfigList> for &Application { - type Error = anyhow::Error; - - fn try_into(self) -> std::result::Result, Self::Error> { +impl Application { + pub fn build_app_config(&self, app_name: &str) -> std::result::Result, anyhow::Error> { let server_name_string = self.server_name.as_ref().ok_or(anyhow!("Missing server_name"))?; // reverse proxy settings @@ -202,6 +200,7 @@ impl TryInto> for &Application { }; Ok(AppConfig { + app_name: app_name.to_owned(), server_name: server_name_string.to_owned(), reverse_proxy: reverse_proxy_config, tls: tls_config, diff --git a/rpxy-lib/src/globals.rs b/rpxy-lib/src/globals.rs index f97bc3b..6614b5c 100644 --- a/rpxy-lib/src/globals.rs +++ b/rpxy-lib/src/globals.rs @@ -125,7 +125,10 @@ where backends .apps .insert(app_config.server_name.clone().to_server_name_vec(), backend); - info!("Registering application: ({})", &app_config.server_name); + info!( + "Registering application {} ({})", + &app_config.server_name, &app_config.app_name + ); } // default backend application for plaintext http requests @@ -154,6 +157,7 @@ pub struct AppConfig where T: CryptoSource, { + pub app_name: String, pub server_name: String, pub reverse_proxy: Vec, pub tls: Option>, @@ -171,7 +175,7 @@ where let reverse_proxy = self.try_into()?; backend_builder - .app_name(self.server_name.clone()) + .app_name(self.app_name.clone()) .server_name(self.server_name.clone()) .reverse_proxy(reverse_proxy);