Skip to content

Commit

Permalink
Merge pull request #3814 from kinvolk/krnowak/custom-user-toml-path
Browse files Browse the repository at this point in the history
Approved by: @nobody from Nowhere
Merged by: The Sentinels
  • Loading branch information
thesentinels authored Nov 6, 2017
2 parents cf65bea + 50f3aad commit e315621
Show file tree
Hide file tree
Showing 2 changed files with 236 additions and 65 deletions.
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

0 comments on commit e315621

Please sign in to comment.