-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
Remove all the deprecated setting fallback logic because it reached the target version and put a warning there if old configuration are still present #33707
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
Conversation
…xpected version and put a warning there
844adda to
564c670
Compare
modules/setting/config_provider.go
Outdated
| func deprecatedSettingWarning(rootCfg ConfigProvider, oldSection, oldKey, newSection, newKey, version string) { | ||
| if rootCfg.Section(oldSection).HasKey(oldKey) { | ||
| LogStartupProblem(1, log.ERROR, "Deprecation: config option `[%s].%s` presents, please use `[%s].%s` instead because this fallback has been removed in %s", oldSection, oldKey, newSection, newKey, version) |
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.
| func deprecatedSettingWarning(rootCfg ConfigProvider, oldSection, oldKey, newSection, newKey, version string) { | |
| if rootCfg.Section(oldSection).HasKey(oldKey) { | |
| LogStartupProblem(1, log.ERROR, "Deprecation: config option `[%s].%s` presents, please use `[%s].%s` instead because this fallback has been removed in %s", oldSection, oldKey, newSection, newKey, version) | |
| // deprecatedSettingWarning is a warning about a setting that has already been removed, giving the user a last chance to fix their app.ini | |
| func deprecatedSettingWarning(rootCfg ConfigProvider, oldSection, oldKey, newSection, newKey, version string) { | |
| if rootCfg.Section(oldSection).HasKey(oldKey) { | |
| LogStartupProblem(1, log.ERROR, "Deprecation: config option `[%s].%s` is still present, please use `[%s].%s` instead. This fallback has been removed in %s", oldSection, oldKey, newSection, newKey, version) |
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.
modules/setting/config_provider.go
Outdated
| // make linter happy when there is no deprecated setting at the moment | ||
| var _ = deprecatedSetting | ||
|
|
||
| func deprecatedSettingWarning(rootCfg ConfigProvider, oldSection, oldKey, newSection, newKey, version string) { |
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.
removedSetting?
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.
5ab0de8
wxiaoguang
left a comment
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.
I think I have told you not only one time: such change breaks existing users.
Especially for some settings like LFS_CONTENT_PATH: the OLD DATA IS LOST!!! because you won't read the old config anymore.
Do you have any idea how to improve it? Fatal if there is an old configuration? Or leave the fallback code forever? |
Some approaches in my mind:
|
| if strings.Contains(host, ":") { | ||
| addr, port, err := net.SplitHostPort(host) | ||
| assert.NoError(t, err) | ||
| sec.NewKey("SMTP_ADDR", addr) | ||
| sec.NewKey("SMTP_PORT", port) | ||
| } else { | ||
| sec.NewKey("SMTP_ADDR", host) | ||
| } |
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.
Why the tests are changed? Does it break?
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.
The test was test the legacy configurations. Now the fallback code was removed. So the test was changed to test the new configurations.
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.
Then I guess the test cases should be updated, but not change the config code here, unless you could clarify the config test code must be changed.
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.
According to your change, the "HOST" key is gone, why you use the trick here to test the non-existing "HOST" config option?
|
Both a system failure and a critical issue can impact the admin user. To ensure awareness, we should implement a mandatory warning page that appears on every login, requiring the admin to acknowledge it before proceeding. Close this PR and leave an new issue for the future action. |
The deprecated setting fallback logic should be removed once the target version is reached. A warning will be displayed if the old configuration items are still present.