mirror of
https://github.com/go-gitea/gitea.git
synced 2024-11-24 02:59:42 +08:00
parent
d2128b44f7
commit
d845be661f
@ -25,9 +25,9 @@ func mustMapSetting(rootCfg ConfigProvider, sectionName string, setting interfac
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func deprecatedSetting(rootCfg ConfigProvider, oldSection, oldKey, newSection, newKey string) {
|
func deprecatedSetting(rootCfg ConfigProvider, oldSection, oldKey, newSection, newKey, version string) {
|
||||||
if rootCfg.Section(oldSection).HasKey(oldKey) {
|
if rootCfg.Section(oldSection).HasKey(oldKey) {
|
||||||
log.Error("Deprecated fallback `[%s]` `%s` present. Use `[%s]` `%s` instead. This fallback will be removed in v1.19.0", oldSection, oldKey, newSection, newKey)
|
log.Error("Deprecated fallback `[%s]` `%s` present. Use `[%s]` `%s` instead. This fallback will be/has been removed in %s", oldSection, oldKey, newSection, newKey, version)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,12 +56,13 @@ func loadIndexerFrom(rootCfg ConfigProvider) {
|
|||||||
Indexer.IssueIndexerName = sec.Key("ISSUE_INDEXER_NAME").MustString(Indexer.IssueIndexerName)
|
Indexer.IssueIndexerName = sec.Key("ISSUE_INDEXER_NAME").MustString(Indexer.IssueIndexerName)
|
||||||
|
|
||||||
// The following settings are deprecated and can be overridden by settings in [queue] or [queue.issue_indexer]
|
// The following settings are deprecated and can be overridden by settings in [queue] or [queue.issue_indexer]
|
||||||
// FIXME: DEPRECATED to be removed in v1.18.0
|
// DEPRECATED should not be removed because users maybe upgrade from lower version to the latest version
|
||||||
deprecatedSetting(rootCfg, "indexer", "ISSUE_INDEXER_QUEUE_TYPE", "queue.issue_indexer", "TYPE")
|
// if these are removed, the warning will not be shown
|
||||||
deprecatedSetting(rootCfg, "indexer", "ISSUE_INDEXER_QUEUE_DIR", "queue.issue_indexer", "DATADIR")
|
deprecatedSetting(rootCfg, "indexer", "ISSUE_INDEXER_QUEUE_TYPE", "queue.issue_indexer", "TYPE", "v1.19.0")
|
||||||
deprecatedSetting(rootCfg, "indexer", "ISSUE_INDEXER_QUEUE_CONN_STR", "queue.issue_indexer", "CONN_STR")
|
deprecatedSetting(rootCfg, "indexer", "ISSUE_INDEXER_QUEUE_DIR", "queue.issue_indexer", "DATADIR", "v1.19.0")
|
||||||
deprecatedSetting(rootCfg, "indexer", "ISSUE_INDEXER_QUEUE_BATCH_NUMBER", "queue.issue_indexer", "BATCH_LENGTH")
|
deprecatedSetting(rootCfg, "indexer", "ISSUE_INDEXER_QUEUE_CONN_STR", "queue.issue_indexer", "CONN_STR", "v1.19.0")
|
||||||
deprecatedSetting(rootCfg, "indexer", "UPDATE_BUFFER_LEN", "queue.issue_indexer", "LENGTH")
|
deprecatedSetting(rootCfg, "indexer", "ISSUE_INDEXER_QUEUE_BATCH_NUMBER", "queue.issue_indexer", "BATCH_LENGTH", "v1.19.0")
|
||||||
|
deprecatedSetting(rootCfg, "indexer", "UPDATE_BUFFER_LEN", "queue.issue_indexer", "LENGTH", "v1.19.0")
|
||||||
|
|
||||||
Indexer.RepoIndexerEnabled = sec.Key("REPO_INDEXER_ENABLED").MustBool(false)
|
Indexer.RepoIndexerEnabled = sec.Key("REPO_INDEXER_ENABLED").MustBool(false)
|
||||||
Indexer.RepoType = sec.Key("REPO_INDEXER_TYPE").MustString("bleve")
|
Indexer.RepoType = sec.Key("REPO_INDEXER_TYPE").MustString("bleve")
|
||||||
|
@ -35,8 +35,9 @@ func loadLFSFrom(rootCfg ConfigProvider) {
|
|||||||
storageType := lfsSec.Key("STORAGE_TYPE").MustString("")
|
storageType := lfsSec.Key("STORAGE_TYPE").MustString("")
|
||||||
|
|
||||||
// Specifically default PATH to LFS_CONTENT_PATH
|
// Specifically default PATH to LFS_CONTENT_PATH
|
||||||
// FIXME: DEPRECATED to be removed in v1.18.0
|
// DEPRECATED should not be removed because users maybe upgrade from lower version to the latest version
|
||||||
deprecatedSetting(rootCfg, "server", "LFS_CONTENT_PATH", "lfs", "PATH")
|
// if these are removed, the warning will not be shown
|
||||||
|
deprecatedSetting(rootCfg, "server", "LFS_CONTENT_PATH", "lfs", "PATH", "v1.19.0")
|
||||||
lfsSec.Key("PATH").MustString(
|
lfsSec.Key("PATH").MustString(
|
||||||
sec.Key("LFS_CONTENT_PATH").String())
|
sec.Key("LFS_CONTENT_PATH").String())
|
||||||
|
|
||||||
|
@ -64,16 +64,16 @@ func loadMailerFrom(rootCfg ConfigProvider) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Handle Deprecations and map on to new configuration
|
// Handle Deprecations and map on to new configuration
|
||||||
// FIXME: DEPRECATED to be removed in v1.19.0
|
// DEPRECATED should not be removed because users maybe upgrade from lower version to the latest version
|
||||||
deprecatedSetting(rootCfg, "mailer", "MAILER_TYPE", "mailer", "PROTOCOL")
|
// if these are removed, the warning will not be shown
|
||||||
|
deprecatedSetting(rootCfg, "mailer", "MAILER_TYPE", "mailer", "PROTOCOL", "v1.19.0")
|
||||||
if sec.HasKey("MAILER_TYPE") && !sec.HasKey("PROTOCOL") {
|
if sec.HasKey("MAILER_TYPE") && !sec.HasKey("PROTOCOL") {
|
||||||
if sec.Key("MAILER_TYPE").String() == "sendmail" {
|
if sec.Key("MAILER_TYPE").String() == "sendmail" {
|
||||||
sec.Key("PROTOCOL").MustString("sendmail")
|
sec.Key("PROTOCOL").MustString("sendmail")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: DEPRECATED to be removed in v1.19.0
|
deprecatedSetting(rootCfg, "mailer", "HOST", "mailer", "SMTP_ADDR", "v1.19.0")
|
||||||
deprecatedSetting(rootCfg, "mailer", "HOST", "mailer", "SMTP_ADDR")
|
|
||||||
if sec.HasKey("HOST") && !sec.HasKey("SMTP_ADDR") {
|
if sec.HasKey("HOST") && !sec.HasKey("SMTP_ADDR") {
|
||||||
givenHost := sec.Key("HOST").String()
|
givenHost := sec.Key("HOST").String()
|
||||||
addr, port, err := net.SplitHostPort(givenHost)
|
addr, port, err := net.SplitHostPort(givenHost)
|
||||||
@ -89,8 +89,7 @@ func loadMailerFrom(rootCfg ConfigProvider) {
|
|||||||
sec.Key("SMTP_PORT").MustString(port)
|
sec.Key("SMTP_PORT").MustString(port)
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: DEPRECATED to be removed in v1.19.0
|
deprecatedSetting(rootCfg, "mailer", "IS_TLS_ENABLED", "mailer", "PROTOCOL", "v1.19.0")
|
||||||
deprecatedSetting(rootCfg, "mailer", "IS_TLS_ENABLED", "mailer", "PROTOCOL")
|
|
||||||
if sec.HasKey("IS_TLS_ENABLED") && !sec.HasKey("PROTOCOL") {
|
if sec.HasKey("IS_TLS_ENABLED") && !sec.HasKey("PROTOCOL") {
|
||||||
if sec.Key("IS_TLS_ENABLED").MustBool() {
|
if sec.Key("IS_TLS_ENABLED").MustBool() {
|
||||||
sec.Key("PROTOCOL").MustString("smtps")
|
sec.Key("PROTOCOL").MustString("smtps")
|
||||||
@ -99,38 +98,32 @@ func loadMailerFrom(rootCfg ConfigProvider) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: DEPRECATED to be removed in v1.19.0
|
deprecatedSetting(rootCfg, "mailer", "DISABLE_HELO", "mailer", "ENABLE_HELO", "v1.19.0")
|
||||||
deprecatedSetting(rootCfg, "mailer", "DISABLE_HELO", "mailer", "ENABLE_HELO")
|
|
||||||
if sec.HasKey("DISABLE_HELO") && !sec.HasKey("ENABLE_HELO") {
|
if sec.HasKey("DISABLE_HELO") && !sec.HasKey("ENABLE_HELO") {
|
||||||
sec.Key("ENABLE_HELO").MustBool(!sec.Key("DISABLE_HELO").MustBool())
|
sec.Key("ENABLE_HELO").MustBool(!sec.Key("DISABLE_HELO").MustBool())
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: DEPRECATED to be removed in v1.19.0
|
deprecatedSetting(rootCfg, "mailer", "SKIP_VERIFY", "mailer", "FORCE_TRUST_SERVER_CERT", "v1.19.0")
|
||||||
deprecatedSetting(rootCfg, "mailer", "SKIP_VERIFY", "mailer", "FORCE_TRUST_SERVER_CERT")
|
|
||||||
if sec.HasKey("SKIP_VERIFY") && !sec.HasKey("FORCE_TRUST_SERVER_CERT") {
|
if sec.HasKey("SKIP_VERIFY") && !sec.HasKey("FORCE_TRUST_SERVER_CERT") {
|
||||||
sec.Key("FORCE_TRUST_SERVER_CERT").MustBool(sec.Key("SKIP_VERIFY").MustBool())
|
sec.Key("FORCE_TRUST_SERVER_CERT").MustBool(sec.Key("SKIP_VERIFY").MustBool())
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: DEPRECATED to be removed in v1.19.0
|
deprecatedSetting(rootCfg, "mailer", "USE_CERTIFICATE", "mailer", "USE_CLIENT_CERT", "v1.19.0")
|
||||||
deprecatedSetting(rootCfg, "mailer", "USE_CERTIFICATE", "mailer", "USE_CLIENT_CERT")
|
|
||||||
if sec.HasKey("USE_CERTIFICATE") && !sec.HasKey("USE_CLIENT_CERT") {
|
if sec.HasKey("USE_CERTIFICATE") && !sec.HasKey("USE_CLIENT_CERT") {
|
||||||
sec.Key("USE_CLIENT_CERT").MustBool(sec.Key("USE_CERTIFICATE").MustBool())
|
sec.Key("USE_CLIENT_CERT").MustBool(sec.Key("USE_CERTIFICATE").MustBool())
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: DEPRECATED to be removed in v1.19.0
|
deprecatedSetting(rootCfg, "mailer", "CERT_FILE", "mailer", "CLIENT_CERT_FILE", "v1.19.0")
|
||||||
deprecatedSetting(rootCfg, "mailer", "CERT_FILE", "mailer", "CLIENT_CERT_FILE")
|
|
||||||
if sec.HasKey("CERT_FILE") && !sec.HasKey("CLIENT_CERT_FILE") {
|
if sec.HasKey("CERT_FILE") && !sec.HasKey("CLIENT_CERT_FILE") {
|
||||||
sec.Key("CERT_FILE").MustString(sec.Key("CERT_FILE").String())
|
sec.Key("CERT_FILE").MustString(sec.Key("CERT_FILE").String())
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: DEPRECATED to be removed in v1.19.0
|
deprecatedSetting(rootCfg, "mailer", "KEY_FILE", "mailer", "CLIENT_KEY_FILE", "v1.19.0")
|
||||||
deprecatedSetting(rootCfg, "mailer", "KEY_FILE", "mailer", "CLIENT_KEY_FILE")
|
|
||||||
if sec.HasKey("KEY_FILE") && !sec.HasKey("CLIENT_KEY_FILE") {
|
if sec.HasKey("KEY_FILE") && !sec.HasKey("CLIENT_KEY_FILE") {
|
||||||
sec.Key("KEY_FILE").MustString(sec.Key("KEY_FILE").String())
|
sec.Key("KEY_FILE").MustString(sec.Key("KEY_FILE").String())
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: DEPRECATED to be removed in v1.19.0
|
deprecatedSetting(rootCfg, "mailer", "ENABLE_HTML_ALTERNATIVE", "mailer", "SEND_AS_PLAIN_TEXT", "v1.19.0")
|
||||||
deprecatedSetting(rootCfg, "mailer", "ENABLE_HTML_ALTERNATIVE", "mailer", "SEND_AS_PLAIN_TEXT")
|
|
||||||
if sec.HasKey("ENABLE_HTML_ALTERNATIVE") && !sec.HasKey("SEND_AS_PLAIN_TEXT") {
|
if sec.HasKey("ENABLE_HTML_ALTERNATIVE") && !sec.HasKey("SEND_AS_PLAIN_TEXT") {
|
||||||
sec.Key("SEND_AS_PLAIN_TEXT").MustBool(!sec.Key("ENABLE_HTML_ALTERNATIVE").MustBool(false))
|
sec.Key("SEND_AS_PLAIN_TEXT").MustBool(!sec.Key("ENABLE_HTML_ALTERNATIVE").MustBool(false))
|
||||||
}
|
}
|
||||||
|
@ -27,8 +27,9 @@ var Mirror = struct {
|
|||||||
func loadMirrorFrom(rootCfg ConfigProvider) {
|
func loadMirrorFrom(rootCfg ConfigProvider) {
|
||||||
// Handle old configuration through `[repository]` `DISABLE_MIRRORS`
|
// Handle old configuration through `[repository]` `DISABLE_MIRRORS`
|
||||||
// - please note this was badly named and only disabled the creation of new pull mirrors
|
// - please note this was badly named and only disabled the creation of new pull mirrors
|
||||||
// FIXME: DEPRECATED to be removed in v1.18.0
|
// DEPRECATED should not be removed because users maybe upgrade from lower version to the latest version
|
||||||
deprecatedSetting(rootCfg, "repository", "DISABLE_MIRRORS", "mirror", "ENABLED")
|
// if these are removed, the warning will not be shown
|
||||||
|
deprecatedSetting(rootCfg, "repository", "DISABLE_MIRRORS", "mirror", "ENABLED", "v1.19.0")
|
||||||
if rootCfg.Section("repository").Key("DISABLE_MIRRORS").MustBool(false) {
|
if rootCfg.Section("repository").Key("DISABLE_MIRRORS").MustBool(false) {
|
||||||
Mirror.DisableNewPull = true
|
Mirror.DisableNewPull = true
|
||||||
}
|
}
|
||||||
|
@ -178,38 +178,40 @@ func loadServerFrom(rootCfg ConfigProvider) {
|
|||||||
switch protocolCfg {
|
switch protocolCfg {
|
||||||
case "https":
|
case "https":
|
||||||
Protocol = HTTPS
|
Protocol = HTTPS
|
||||||
// FIXME: DEPRECATED to be removed in v1.18.0
|
|
||||||
|
// DEPRECATED should not be removed because users maybe upgrade from lower version to the latest version
|
||||||
|
// if these are removed, the warning will not be shown
|
||||||
if sec.HasKey("ENABLE_ACME") {
|
if sec.HasKey("ENABLE_ACME") {
|
||||||
EnableAcme = sec.Key("ENABLE_ACME").MustBool(false)
|
EnableAcme = sec.Key("ENABLE_ACME").MustBool(false)
|
||||||
} else {
|
} else {
|
||||||
deprecatedSetting(rootCfg, "server", "ENABLE_LETSENCRYPT", "server", "ENABLE_ACME")
|
deprecatedSetting(rootCfg, "server", "ENABLE_LETSENCRYPT", "server", "ENABLE_ACME", "v1.19.0")
|
||||||
EnableAcme = sec.Key("ENABLE_LETSENCRYPT").MustBool(false)
|
EnableAcme = sec.Key("ENABLE_LETSENCRYPT").MustBool(false)
|
||||||
}
|
}
|
||||||
if EnableAcme {
|
if EnableAcme {
|
||||||
AcmeURL = sec.Key("ACME_URL").MustString("")
|
AcmeURL = sec.Key("ACME_URL").MustString("")
|
||||||
AcmeCARoot = sec.Key("ACME_CA_ROOT").MustString("")
|
AcmeCARoot = sec.Key("ACME_CA_ROOT").MustString("")
|
||||||
// FIXME: DEPRECATED to be removed in v1.18.0
|
|
||||||
if sec.HasKey("ACME_ACCEPTTOS") {
|
if sec.HasKey("ACME_ACCEPTTOS") {
|
||||||
AcmeTOS = sec.Key("ACME_ACCEPTTOS").MustBool(false)
|
AcmeTOS = sec.Key("ACME_ACCEPTTOS").MustBool(false)
|
||||||
} else {
|
} else {
|
||||||
deprecatedSetting(rootCfg, "server", "LETSENCRYPT_ACCEPTTOS", "server", "ACME_ACCEPTTOS")
|
deprecatedSetting(rootCfg, "server", "LETSENCRYPT_ACCEPTTOS", "server", "ACME_ACCEPTTOS", "v1.19.0")
|
||||||
AcmeTOS = sec.Key("LETSENCRYPT_ACCEPTTOS").MustBool(false)
|
AcmeTOS = sec.Key("LETSENCRYPT_ACCEPTTOS").MustBool(false)
|
||||||
}
|
}
|
||||||
if !AcmeTOS {
|
if !AcmeTOS {
|
||||||
log.Fatal("ACME TOS is not accepted (ACME_ACCEPTTOS).")
|
log.Fatal("ACME TOS is not accepted (ACME_ACCEPTTOS).")
|
||||||
}
|
}
|
||||||
// FIXME: DEPRECATED to be removed in v1.18.0
|
|
||||||
if sec.HasKey("ACME_DIRECTORY") {
|
if sec.HasKey("ACME_DIRECTORY") {
|
||||||
AcmeLiveDirectory = sec.Key("ACME_DIRECTORY").MustString("https")
|
AcmeLiveDirectory = sec.Key("ACME_DIRECTORY").MustString("https")
|
||||||
} else {
|
} else {
|
||||||
deprecatedSetting(rootCfg, "server", "LETSENCRYPT_DIRECTORY", "server", "ACME_DIRECTORY")
|
deprecatedSetting(rootCfg, "server", "LETSENCRYPT_DIRECTORY", "server", "ACME_DIRECTORY", "v1.19.0")
|
||||||
AcmeLiveDirectory = sec.Key("LETSENCRYPT_DIRECTORY").MustString("https")
|
AcmeLiveDirectory = sec.Key("LETSENCRYPT_DIRECTORY").MustString("https")
|
||||||
}
|
}
|
||||||
// FIXME: DEPRECATED to be removed in v1.18.0
|
|
||||||
if sec.HasKey("ACME_EMAIL") {
|
if sec.HasKey("ACME_EMAIL") {
|
||||||
AcmeEmail = sec.Key("ACME_EMAIL").MustString("")
|
AcmeEmail = sec.Key("ACME_EMAIL").MustString("")
|
||||||
} else {
|
} else {
|
||||||
deprecatedSetting(rootCfg, "server", "LETSENCRYPT_EMAIL", "server", "ACME_EMAIL")
|
deprecatedSetting(rootCfg, "server", "LETSENCRYPT_EMAIL", "server", "ACME_EMAIL", "v1.19.0")
|
||||||
AcmeEmail = sec.Key("LETSENCRYPT_EMAIL").MustString("")
|
AcmeEmail = sec.Key("LETSENCRYPT_EMAIL").MustString("")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -3,15 +3,16 @@
|
|||||||
|
|
||||||
package setting
|
package setting
|
||||||
|
|
||||||
// FIXME: DEPRECATED to be removed in v1.18.0
|
// DEPRECATED should not be removed because users maybe upgrade from lower version to the latest version
|
||||||
|
// if these are removed, the warning will not be shown
|
||||||
// - will need to set default for [queue.task] LENGTH to 1000 though
|
// - will need to set default for [queue.task] LENGTH to 1000 though
|
||||||
func loadTaskFrom(rootCfg ConfigProvider) {
|
func loadTaskFrom(rootCfg ConfigProvider) {
|
||||||
taskSec := rootCfg.Section("task")
|
taskSec := rootCfg.Section("task")
|
||||||
queueTaskSec := rootCfg.Section("queue.task")
|
queueTaskSec := rootCfg.Section("queue.task")
|
||||||
|
|
||||||
deprecatedSetting(rootCfg, "task", "QUEUE_TYPE", "queue.task", "TYPE")
|
deprecatedSetting(rootCfg, "task", "QUEUE_TYPE", "queue.task", "TYPE", "v1.19.0")
|
||||||
deprecatedSetting(rootCfg, "task", "QUEUE_CONN_STR", "queue.task", "CONN_STR")
|
deprecatedSetting(rootCfg, "task", "QUEUE_CONN_STR", "queue.task", "CONN_STR", "v1.19.0")
|
||||||
deprecatedSetting(rootCfg, "task", "QUEUE_LENGTH", "queue.task", "LENGTH")
|
deprecatedSetting(rootCfg, "task", "QUEUE_LENGTH", "queue.task", "LENGTH", "v1.19.0")
|
||||||
|
|
||||||
switch taskSec.Key("QUEUE_TYPE").MustString("channel") {
|
switch taskSec.Key("QUEUE_TYPE").MustString("channel") {
|
||||||
case "channel":
|
case "channel":
|
||||||
|
Loading…
Reference in New Issue
Block a user