Add never option to PUBLIC_URL_DETECTION configuration (#36785)

Follow up #34250

Docs: https://gitea.com/gitea/docs/pulls/353

---------

Signed-off-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
Zettat123
2026-03-01 11:33:47 -07:00
committed by GitHub
parent 2c624d4deb
commit 5b8c8e724f
4 changed files with 22 additions and 1 deletions
+2 -1
View File
@@ -44,6 +44,7 @@ const (
const (
PublicURLAuto = "auto"
PublicURLLegacy = "legacy"
PublicURLNever = "never"
)
// Server settings
@@ -286,7 +287,7 @@ func loadServerFrom(rootCfg ConfigProvider) {
defaultAppURL := string(Protocol) + "://" + Domain + ":" + HTTPPort
AppURL = sec.Key("ROOT_URL").MustString(defaultAppURL)
PublicURLDetection = sec.Key("PUBLIC_URL_DETECTION").MustString(PublicURLLegacy)
if PublicURLDetection != PublicURLAuto && PublicURLDetection != PublicURLLegacy {
if PublicURLDetection != PublicURLAuto && PublicURLDetection != PublicURLLegacy && PublicURLDetection != PublicURLNever {
log.Fatal("Invalid PUBLIC_URL_DETECTION value: %s", PublicURLDetection)
}