Skip to content
Snippets Groups Projects
Verified Commit 49da288d authored by Nik | Klampfradler's avatar Nik | Klampfradler
Browse files

Use BASE_NAME constant everywhere isntead of hard-coded name

parent a7216b77
No related branches found
No related tags found
No related merge requests found
......@@ -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();
......
......@@ -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");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment