forked from forgejo/forgejo
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:
parent
76aa33d884
commit
97625b44e7
6 changed files with 133 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue