Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an alternative path for user.toml #3814

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions components/sup/src/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ lazy_static! {
pub static ref SVC_ROOT: PathBuf = {
Path::new(&*FS_ROOT_PATH).join("hab/svc")
};

pub static ref USER_ROOT: PathBuf = {
Path::new(&*FS_ROOT_PATH).join("hab/user")
};
}

/// Returns the root path for a given service's configuration, files, and data.
Expand Down Expand Up @@ -66,3 +70,15 @@ pub fn svc_logs_path<T: AsRef<Path>>(service_name: T) -> PathBuf {
pub fn svc_pid_file<T: AsRef<Path>>(service_name: T) -> PathBuf {
svc_path(service_name).join("PID")
}

/// Returns the root path for a given service's user configuration,
/// files, and data.
pub fn user_path<T: AsRef<Path>>(service_name: T) -> PathBuf {
USER_ROOT.join(service_name)
}

/// Returns the path to a given service's user configuration
/// directory.
pub fn user_config_path<T: AsRef<Path>>(service_name: T) -> PathBuf {
user_path(service_name).join("config")
}
Loading