2023-02-19 09:12:01 -07:00
|
|
|
// Copyright 2023 The Gitea Authors. All rights reserved.
|
|
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
|
|
|
|
package setting
|
|
|
|
|
2024-09-21 03:50:54 -06:00
|
|
|
import (
|
|
|
|
"strconv"
|
|
|
|
|
|
|
|
"code.gitea.io/gitea/modules/log"
|
|
|
|
)
|
2023-02-19 09:12:01 -07:00
|
|
|
|
|
|
|
var Camo = struct {
|
|
|
|
Enabled bool
|
|
|
|
ServerURL string `ini:"SERVER_URL"`
|
|
|
|
HMACKey string `ini:"HMAC_KEY"`
|
2024-09-21 03:50:54 -06:00
|
|
|
Always bool
|
2023-02-19 09:12:01 -07:00
|
|
|
}{}
|
|
|
|
|
|
|
|
func loadCamoFrom(rootCfg ConfigProvider) {
|
|
|
|
mustMapSetting(rootCfg, "camo", &Camo)
|
|
|
|
if Camo.Enabled {
|
2024-09-21 03:50:54 -06: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 09:12:01 -07:00
|
|
|
if Camo.ServerURL == "" || Camo.HMACKey == "" {
|
|
|
|
log.Fatal(`Camo settings require "SERVER_URL" and HMAC_KEY`)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|