Skip to content

added sarusctl user home config fallback#21

Open
fcruzcscs wants to merge 4 commits into
mainfrom
sarusctl-home-config
Open

added sarusctl user home config fallback#21
fcruzcscs wants to merge 4 commits into
mainfrom
sarusctl-home-config

Conversation

@fcruzcscs

Copy link
Copy Markdown
Member

makes sarusctl usable with a per-user config directory at ~/.config/sarus-suite when /etc/sarus-suite is missing, without requiring raster any new search behavior as we implement the policy in sarusctl while the intrinsic implementation relies in raster.

@fcruzcscs fcruzcscs requested a review from Madeeks June 9, 2026 16:29
@fcruzcscs

Copy link
Copy Markdown
Member Author

@Madeeks I basically replaced the raster default config load to fn load_config_with_fallback, which allows sarusctl to define policy, in this case, if "/etc/sarus-suite" does not exist it will try to read "$HOME/.config/sarus-suite", this will help get sarusctl to be usable directly from user-space

}

fn config_dir_exists(path: &Path) -> Result<bool, AppError> {
match fs::metadata(path) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not https://doc.rust-lang.org/std/fs/fn.exists.html?

To return a more detailed error type?

}
}

fn ensure_default_user_config_dir() {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this needed?

If I'm not mistaken this is used only in the RasterOps test mock, but the related unit tests all create a custom user_dir.
For all the other tests, they shouldn't need a default path anyways because the mock loading function doesn't actually access the path.
Or am I missing something?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants