From 1fa617cb5e3103e5d12fbf1647706a03ec8d8a66 Mon Sep 17 00:00:00 2001 From: Earl Warren Date: Tue, 23 Jan 2024 09:43:29 +0000 Subject: [PATCH] [F3] setting [F3].ENABLED (cherry picked from commit b11c68b73413a86ee171589685fe8708fb52179e) --- custom/conf/app.example.ini | 9 +++++++++ modules/setting/f3.go | 22 ++++++++++++++++++++++ modules/setting/setting.go | 1 + 3 files changed, 32 insertions(+) create mode 100644 modules/setting/f3.go diff --git a/custom/conf/app.example.ini b/custom/conf/app.example.ini index 5b84d30938..bbfd675cb0 100644 --- a/custom/conf/app.example.ini +++ b/custom/conf/app.example.ini @@ -2396,6 +2396,15 @@ LEVEL = Info ;; If a domain is allowed by ALLOWED_DOMAINS, this option will be ignored. ;ALLOW_LOCALNETWORKS = false +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;[F3] +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;; Enable/Disable Friendly Forge Format (F3) +;ENABLED = false + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;[federation] diff --git a/modules/setting/f3.go b/modules/setting/f3.go new file mode 100644 index 0000000000..8a66d68fc6 --- /dev/null +++ b/modules/setting/f3.go @@ -0,0 +1,22 @@ +// SPDX-License-Identifier: MIT + +package setting + +import ( + "code.gitea.io/gitea/modules/log" +) + +// Friendly Forge Format (F3) settings +var ( + F3 = struct { + Enabled bool + }{ + Enabled: false, + } +) + +func loadF3From(rootCfg ConfigProvider) { + if err := rootCfg.Section("F3").MapTo(&F3); err != nil { + log.Fatal("Failed to map F3 settings: %v", err) + } +} diff --git a/modules/setting/setting.go b/modules/setting/setting.go index ebfd3b27be..6f963e2030 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -220,6 +220,7 @@ func LoadSettings() { loadProjectFrom(CfgProvider) loadMimeTypeMapFrom(CfgProvider) loadFederationFrom(CfgProvider) + loadF3From(CfgProvider) } // LoadSettingsForInstall initializes the settings for install