feat: add new logic for rule based bans
All checks were successful
CI.yml / build (push) Successful in 1m51s
All checks were successful
CI.yml / build (push) Successful in 1m51s
This commit is contained in:
22
internal/config/appconf.go
Normal file
22
internal/config/appconf.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/BurntSushi/toml"
|
||||
"github.com/d3m0k1d/BanForge/internal/logger"
|
||||
)
|
||||
|
||||
func LoadRuleConfig() ([]Rule, error) {
|
||||
log := logger.New(false)
|
||||
var cfg Rules
|
||||
|
||||
_, err := toml.DecodeFile("/etc/banforge/rules.toml", &cfg)
|
||||
if err != nil {
|
||||
log.Error(fmt.Sprintf("failed to decode config: %v", err))
|
||||
return nil, err
|
||||
}
|
||||
|
||||
log.Info(fmt.Sprintf("loaded %d rules", len(cfg.Rules)))
|
||||
return cfg.Rules, nil
|
||||
}
|
||||
Reference in New Issue
Block a user