1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-03 09:07:19 +00:00

Provide configuration to allow camo-media proxying (#12802)

* Provide configuration to allow camo-media proxying

Fix #916

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
zeripath
2022-03-29 09:27:37 +01:00
committed by GitHub
parent 76aa33d884
commit 97625b44e7
6 changed files with 133 additions and 1 deletions

View File

@ -197,6 +197,13 @@ var (
PasswordCheckPwn bool
SuccessfulTokensCacheSize int
Camo = struct {
Enabled bool
ServerURL string `ini:"SERVER_URL"`
HMACKey string `ini:"HMAC_KEY"`
Allways bool
}{}
// UI settings
UI = struct {
ExplorePagingNum int
@ -1019,6 +1026,14 @@ func loadFromConf(allowEmpty bool, extraConfig string) {
log.Fatal("Failed to map API settings: %v", err)
} else if err = Cfg.Section("metrics").MapTo(&Metrics); err != nil {
log.Fatal("Failed to map Metrics settings: %v", err)
} else if err = Cfg.Section("camo").MapTo(&Camo); err != nil {
log.Fatal("Failed to map Camo settings: %v", err)
}
if Camo.Enabled {
if Camo.ServerURL == "" || Camo.HMACKey == "" {
log.Fatal(`Camo settings require "SERVER_URL" and HMAC_KEY`)
}
}
u := *appURL