Module config

Source
Expand description

Default locations for Signstar configuration files.

ยงExamples

use signstar_common::config::{
    get_config_file_or_default,
    get_config_file_paths,
    get_config_file,
    get_default_config_dir_path,
    get_default_config_file_path,
    get_etc_override_config_file_path,
    get_etc_override_dir_path,
    get_run_override_config_file_path,
    get_run_override_dir_path,
    get_usr_local_override_config_file_path,
    get_usr_local_override_dir_path,
};

// Get directory paths for Signstar configuration files.
println!("{:?}", get_etc_override_dir_path());
println!("{:?}", get_run_override_dir_path());
println!("{:?}", get_usr_local_override_dir_path());
println!("{:?}", get_default_config_dir_path());

// Get file paths for Signstar configuration files.
println!("{:?}", get_etc_override_config_file_path());
println!("{:?}", get_run_override_config_file_path());
println!("{:?}", get_usr_local_override_config_file_path());
println!("{:?}", get_default_config_file_path());

// Get the first config file found, according to directory precedence.
println!("{:?}", get_config_file());

// Get the first config file found, according to directory precedence, or the default if none are found.
println!("{:?}", get_config_file_or_default());

// Get all configuration file paths, sorted by directory precedence.
println!("{:?}", get_config_file_paths());

Enumsยง

Error
An error that may occur when handling configuration directories or files.

Constantsยง

CONFIG_FILE ๐Ÿ”’
The filename of a Signstar configuration file.
DEFAULT_CONFIG_DIR ๐Ÿ”’
The default config directory below โ€œ/usrโ€ for Signstar hosts.
ETC_OVERRIDE_CONFIG_DIR ๐Ÿ”’
The override config directory below โ€œ/etcโ€ for Signstar hosts.
RUN_OVERRIDE_CONFIG_DIR ๐Ÿ”’
The override config directory below โ€œ/runโ€ for Signstar hosts.
USR_LOCAL_OVERRIDE_CONFIG_DIR ๐Ÿ”’
The override config directory below โ€œ/usr/localโ€ for Signstar hosts.

Functionsยง

create_default_config_dir
Creates the default configuration directory below /usr.
create_etc_override_config_dir
Creates the configuration override dir below /etc.
create_run_override_config_dir
Creates the configuration override dir below /run.
create_usr_local_override_config_dir
Creates the configuration override dir below /usr/local.
get_config_file
Returns the first Signstar configuration file available, or None if none found.
get_config_file_or_default
Returns the first Signstar configuration file available, or the default if none found.
get_config_file_paths
Returns a list of all configuration file locations, sorted by precedence.
get_default_config_dir_path
Returns the directory path of the default configuration directory below /usr.
get_default_config_file_path
Returns the file path of the default configuration file /usr.
get_etc_override_config_file_path
Returns the file path of the configuration file override below /etc.
get_etc_override_dir_path
Returns the directory path of the configuration override directory below /etc.
get_run_override_config_file_path
Returns the file path of the configuration file override below /run.
get_run_override_dir_path
Returns the directory path of the configuration override directory below /run.
get_usr_local_override_config_file_path
Returns the file path of the configuration file override below /usr/local.
get_usr_local_override_dir_path
Returns the directory path of the configuration override directory below /usr/local.