mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-10-05 19:30:58 +00:00
Add timeout, rework moderation setting loading
Added a configurable timeout and reworked the way we load moderation settings
This commit is contained in:
parent
1faab33da5
commit
7a124fb0ce
3 changed files with 23 additions and 4 deletions
|
@ -3,13 +3,26 @@
|
|||
|
||||
package setting
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Moderation settings
|
||||
var Moderation = struct {
|
||||
Enabled bool `ini:"ENABLED"`
|
||||
Enabled bool `ini:"ENABLED"`
|
||||
RemoveResolvedReportsTimeout time.Duration `ini:"REMOVE_RESOLVED_REPORTS_TIMEOUT"`
|
||||
}{
|
||||
Enabled: false,
|
||||
}
|
||||
|
||||
func loadModerationFrom(rootCfg ConfigProvider) {
|
||||
mustMapSetting(rootCfg, "moderation", &Moderation)
|
||||
func loadModerationFrom(rootCfg ConfigProvider) error {
|
||||
sec := rootCfg.Section("actions")
|
||||
err := sec.MapTo(&Moderation)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to map Actions settings: %v", err)
|
||||
}
|
||||
|
||||
Moderation.RemoveResolvedReportsTimeout = sec.Key("REMOVE_RESOLVED_REPORTS_TIMEOUT").MustDuration(10 * time.Minute)
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue