move scanip from cmdline to config
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing

This commit is contained in:
Paul 2024-09-11 13:28:09 +02:00
parent 6561a77d6d
commit 4e979d76a3
2 changed files with 9 additions and 11 deletions

View File

@ -36,7 +36,7 @@ func main() {
}
defer cfg.Db.Close()
if !cfg.Switchs.NoScanIP {
if cfg.Options.ScanIP {
go models.ScanIP(&cfg)
}

View File

@ -14,7 +14,6 @@ func (cfg *Config) GetConfig() error {
var init bool
var port int
var version bool
var noscanip bool
var migrate bool
flag.Usage = utils.Usage
@ -24,7 +23,6 @@ func (cfg *Config) GetConfig() error {
flag.BoolVar(&drop, "drop", false, "If dropping tables must occur")
flag.BoolVar(&init, "init", false, "If init of database must be done")
flag.BoolVar(&version, "version", false, "Show version")
flag.BoolVar(&noscanip, "noscanip", false, "Do not run scanip")
flag.BoolVar(&migrate, "migrate", false, "Do migrations on version changes")
flag.Parse()
@ -33,7 +31,6 @@ func (cfg *Config) GetConfig() error {
cfg.Switchs.Init = init
cfg.Switchs.Port = port
cfg.Switchs.Version = version
cfg.Switchs.NoScanIP = noscanip
cfg.Switchs.Migrate = migrate
var inicfg, err = ini.Load(configfile)
@ -51,6 +48,7 @@ func (cfg *Config) GetConfig() error {
cfg.Options.SocketChannel = "ipbl"
cfg.Options.HideBanner = ipblsection.Key("hidebanner").MustBool(false)
cfg.Options.Debug = ipblsection.Key("debug").MustBool(false)
cfg.Options.ScanIP = ipblsection.Key("scanip").MustBool(false)
return nil
}
@ -68,14 +66,14 @@ type Config struct {
HideBanner bool
SocketChannel string
Debug bool
ScanIP bool
}
Switchs struct {
Port int
NoFeed bool
Drop bool
Init bool
Version bool
NoScanIP bool
Migrate bool
Port int
NoFeed bool
Drop bool
Init bool
Version bool
Migrate bool
}
}