Centralize utilities for configuration loading and path parsing#1448
Merged
katiewasnothere merged 2 commits intoMay 8, 2026
Conversation
Contributor
Author
|
Mainly looking for API feedback, changes will not be mergable until TOML PR is merged |
1 task
hajimohammadsamirazizi-lab
approved these changes
Apr 27, 2026
9da3975 to
83d58aa
Compare
Separates path resolution (PathUtils) from TOML loading (ConfigurationLoader) in ContainerPersistence. - PathUtils: resolves base paths for .home (XDG priority) and .appRoot - ConfigurationLoader: load() reads from appRoot, copyConfigToAppRoot() syncs user config with non-throwing error logging - ContainerSystemConfig: now non-final with Initable conformance - All ~17 callsites simplified to ConfigurationLoader.load()
83d58aa to
30566ee
Compare
Changes: * Remove duplicated UserConfiguration in favor of PathUtils * Remove stray logger in ConfigurationLoader
jglogan
approved these changes
May 8, 2026
jglogan
left a comment
Contributor
There was a problem hiding this comment.
lgtm, see follow-up notes
| let containerSystemConfig: ContainerSystemConfig = try ConfigurationLoader.load() | ||
| let appRootPath = FilePath(appRoot.path(percentEncoded: false)) | ||
| try ConfigurationLoader.copyConfigurationToReadOnly(to: appRootPath) | ||
| let containerSystemConfig: ContainerSystemConfig = try ConfigurationLoader.load( |
Contributor
There was a problem hiding this comment.
nit for the next commit: we can use type inference here and shorten the line
| case .home: | ||
| let configHome: String | ||
| if let xdg = ProcessInfo.processInfo.environment["XDG_CONFIG_HOME"], !xdg.isEmpty { | ||
| if let xdg = env["XDG_CONFIG_HOME"], !xdg.isEmpty { |
Contributor
There was a problem hiding this comment.
Need a follow up PR to scrub ContainerPersistence for string and URL path manipulation. I took care of this for the entity store type.
e.g. we could start here with something like:
let configHome = env["XDG_CONFIG_HOME"]
.map { FilePath($0) }
?? FilePath(NSHomeDirectory()).appending("/.config")
katiewasnothere
approved these changes
May 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type of Change
Motivation and Context
This attempts to create a more centralized utility to find and load configuration files, as a follow up to (pr: #1425).
This would make the file apis look something like:
Testing