2023-02-19 16:12:01 +00:00
|
|
|
// Copyright 2023 The Gitea Authors. All rights reserved.
|
|
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
|
|
|
|
package setting
|
|
|
|
|
2024-09-21 09:50:54 +00:00
|
|
|
import (
|
|
|
|
"strconv"
|
|
|
|
|
|
|
|
"code.gitea.io/gitea/modules/log"
|
|
|
|
)
|
2023-02-19 16:12:01 +00:00
|
|
|
|
|
|
|
var Camo = struct {
|
|
|
|
Enabled bool
|
|
|
|
ServerURL string `ini:"SERVER_URL"`
|
|
|
|
HMACKey string `ini:"HMAC_KEY"`
|
2024-09-21 09:50:54 +00:00
|
|
|
Always bool
|
2023-02-19 16:12:01 +00:00
|
|
|
}{}
|
|
|
|
|
|
|
|
func loadCamoFrom(rootCfg ConfigProvider) {
|
|
|
|
mustMapSetting(rootCfg, "camo", &Camo)
|
|
|
|
if Camo.Enabled {
|
2024-09-21 09:50:54 +00:00
|
|
|
oldValue := rootCfg.Section("camo").Key("ALLWAYS").MustString("")
|
|
|
|
if oldValue != "" {
|
|
|
|
log.Warn("camo.ALLWAYS is deprecated, use camo.ALWAYS instead")
|
|
|
|
Camo.Always, _ = strconv.ParseBool(oldValue)
|
|
|
|
}
|
|
|
|
|
2023-02-19 16:12:01 +00:00
|
|
|
if Camo.ServerURL == "" || Camo.HMACKey == "" {
|
|
|
|
log.Fatal(`Camo settings require "SERVER_URL" and HMAC_KEY`)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|