diff --git a/src/config.rs b/src/config.rs index 3885dd4e36c60945686a5dede0b1e818e88c664f..9009b2d608ec9fd5a28eb0a66ac9182c0daf1864 100644 --- a/src/config.rs +++ b/src/config.rs @@ -13,11 +13,13 @@ * limitations under the License. */ +use crate::BASE_NAME; + use serde::de::Deserialize; extern crate config; -const DEFAULT_CONFIG_FILE: &str = "/etc/nss_pam_oidc"; +const DEFAULT_CONFIG_FILE: &str = ("/etc/".to_string() + BASE_NAME).as_str(); pub fn get_config(conf_args: Option<config::Config>) -> config::Config { // Preset default configuration @@ -35,7 +37,7 @@ pub fn get_config(conf_args: Option<config::Config>) -> config::Config { conf.merge(config::File::with_name(&config_file)).ok(); // Override configuration from environment variables - conf.merge(config::Environment::with_prefix("NSS_PAM_OIDC")).ok(); + conf.merge(config::Environment::with_prefix(BASE_NAME.to_string().to_uppercase().as_str())).ok(); // Override configuration from args passed on module loading (e.g. args in PAM stack) conf.merge(conf_args).ok(); diff --git a/src/logging.rs b/src/logging.rs index ba896db19e4df48df9d3a5489c19bdc2bdf164c8..e14d292a14978ee8e904ca3c8489552627c75186 100644 --- a/src/logging.rs +++ b/src/logging.rs @@ -14,6 +14,8 @@ * limitations under the License. */ +use crate::BASE_NAME; + use std::process; use std::convert::TryInto; @@ -24,7 +26,7 @@ pub fn setup_log(log_level: LevelFilter) { let formatter = Formatter3164 { facility: Facility::LOG_AUTHPRIV, hostname: None, - process: "nss_pam_oidc".into(), + process: BASE_NAME.into(), pid: process::id().try_into().unwrap_or_default(), }; let logger = syslog::unix(formatter).expect("could not connect to syslog");