-
-
Notifications
You must be signed in to change notification settings - Fork 107
Prefer a less-generic config file sws.toml as default and keep the old config.toml temporarily
#551
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
Prefer a less-generic config file sws.toml as default and keep the old config.toml temporarily
#551
Conversation
Changed Files
|
|
Hey @davlgd, based on #550 (comment). Here are some steps you can take:
Let me know your thoughts on that. |
655973b to
fdb0bcf
Compare
|
@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
| // 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)? { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a comment for me to remove that check later in a future release.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine to me.
I will take care of the CI warnings.
Thanks!
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):