Skip to content

Commit

Permalink
Adjust env variables naming
Browse files Browse the repository at this point in the history
  • Loading branch information
denisonbarbosa committed Sep 19, 2023
1 parent 41e40ae commit 348fdc1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion nss/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ name = "nss_authd"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[features]
# Allows to override the socket path used to connect to the grpc server, through the NSS_AUTHD_SOCKET env variable.
# Allows to override the socket path used to connect to the grpc server, through the AUTHD_NSS_SOCKET env variable.
custom_socket = []

[dependencies]
Expand Down
6 changes: 3 additions & 3 deletions nss/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ fn init_logger() {

/// socket_path returns the socket path to connect to the gRPC server.
///
/// It uses the NSS_AUTHD_SOCKET env value if set and the custom_socket feature is enabled,
/// It uses the AUTHD_NSS_SOCKET env value if set and the custom_socket feature is enabled,
/// otherwise it uses the default path.
fn socket_path() -> String {
#[cfg(feature = "custom_socket")]
match std::env::var("NSS_AUTHD_SOCKET") {
match std::env::var("AUTHD_NSS_SOCKET") {
Ok(s) => return s,
Err(err) => {
debug!(
"NSS_AUTHD_SOCKET not set or badly configured, using default value: {}",
"AUTHD_NSS_SOCKET not set or badly configured, using default value: {}",
err
);
}
Expand Down
4 changes: 2 additions & 2 deletions nss/src/logs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ macro_rules! error {
/// init_logger initialize the global logger with a default level set to info. This function is only
/// required to be called once and is a no-op on subsequent calls.
///
/// The log level can be set to debug by setting the environment variable NSS_AUTHD_DEBUG.
/// The log level can be set to debug by setting the environment variable AUTHD_NSS_DEBUG.
pub fn init_logger() {
if log::logger().enabled(&Metadata::builder().build()) {
return;
}

let mut level = LevelFilter::Info;
if let Ok(target) = env::var("NSS_AUTHD_DEBUG") {
if let Ok(target) = env::var("AUTHD_NSS_DEBUG") {
level = LevelFilter::Debug;
match target {
s if s == *"stderr" => init_stderr_logger(level),
Expand Down

0 comments on commit 348fdc1

Please sign in to comment.