1
0
Fork 0
forked from forgejo/forgejo

Enable deprecation error for v1.17.0 (#18341)

Co-authored-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
Gusted 2022-01-20 18:00:38 +01:00 committed by GitHub
parent 16d378fefc
commit 1d98d205f5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 84 additions and 52 deletions

View file

@ -387,6 +387,7 @@ var (
MaxTokenLength: math.MaxInt16,
}
// FIXME: DEPRECATED to be removed in v1.18.0
U2F = struct {
AppID string
}{}
@ -563,6 +564,12 @@ func LoadForTest(extraConfigs ...string) {
}
}
func deprecatedSetting(oldSection, oldKey, newSection, newKey string) {
if Cfg.Section(oldSection).HasKey(oldKey) {
log.Error("Deprecated fallback `[%s]` `%s` present. Use `[%s]` `%s` instead. This fallback will be removed in v1.18.0", oldSection, oldKey, newSection, newKey)
}
}
// loadFromConf initializes configuration context.
// NOTE: do not print any log except error.
func loadFromConf(allowEmpty bool, extraConfig string) {
@ -1022,6 +1029,10 @@ func loadFromConf(allowEmpty bool, extraConfig string) {
UI.CustomEmojisMap[emoji] = ":" + emoji + ":"
}
// FIXME: DEPRECATED to be removed in v1.18.0
if Cfg.Section("U2F").HasKey("APP_ID") {
log.Error("Deprecated setting `[U2F]` `APP_ID` present. This fallback will be removed in v1.18.0")
}
sec = Cfg.Section("U2F")
U2F.AppID = sec.Key("APP_ID").MustString(strings.TrimSuffix(AppURL, "/"))
}