Prefer a less-generic config file sws.toml as default and keep the old config.toml temporarily#551
Merged
joseluisq merged 2 commits intostatic-web-server:masterfrom Jul 2, 2025
Conversation
Changed Files
|
Collaborator
|
Hey @davlgd, based on #550 (comment). Here are some steps you can take:
Let me know your thoughts on that. |
655973b to
fdb0bcf
Compare
Contributor
Author
|
@joseluisq I've made the change as asked. Feel free to update warning message |
- sws.toml used if present - config.toml has priority - A warning message is printed if config.toml is used
fdb0bcf to
c2f1934
Compare
sws.toml as default and keep the old config.toml temporarily
joseluisq
reviewed
Jul 2, 2025
Comment on lines
-227
to
+235
| // Handle "config file options" and set them when available | ||
| // NOTE: All config file based options shouldn't be mandatory, therefore `Some()` wrapped | ||
| if let Some((settings, config_file_resolved)) = read_file_settings(&opts.config_file)? { | ||
| let to_use_config_file = match Path::new("./config.toml").is_file() { | ||
| true => { | ||
| eprintln!("Deprecated: 'config.toml' found, rename it to 'sws.toml' to prepare for future releases"); | ||
| PathBuf::from("./config.toml") | ||
| } | ||
| false => opts.config_file.clone(), | ||
| }; | ||
|
|
||
| if let Some((settings, config_file_resolved)) = read_file_settings(&to_use_config_file)? { |
Collaborator
There was a problem hiding this comment.
Just a comment for me to remove that check later in a future release.
joseluisq
approved these changes
Jul 2, 2025
Collaborator
joseluisq
left a comment
There was a problem hiding this comment.
Looks fine to me.
I will take care of the CI warnings.
Thanks!
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.
This PR tends to fix #550
Description
It changes default config file name to
sws_config.tomlto avoid conflicts. Docs/tests are updated accordingly, if you prefer I can create dedicated commits for that.Related Issue
#550
Motivation and Context
We use Zola and potentially other projects already using a
config.tomlfile as default. When we launch the project, there is unwanted logs as sws use the zola config.toml as its own.Another solution could be to not read/use
config.tomlfile not valid for SWS, but I think it's better to avoid such generic file name. And the sooner the better on such change.Feel free to close this if you prefer to continue with the current file name and go for another solution.
How Has This Been Tested?
I've build the project and used it with a
sws_config.tomlwithout env var or flag to point it. It was perfectly loaded and used.Screenshots (if appropriate):