fix code rabbit

This commit is contained in:
Alban Stourbe 2025-06-24 18:45:35 +02:00
parent 1a9a7563c0
commit 99914e1a32

View File

@ -582,7 +582,7 @@ Additional documentation is available at: https://docs.nuclei.sh/getting-started
}
if !options.Vars.IsEmpty() {
// Maybe we should add vars to the config file as well?
// Maybe we should add vars to the config file as well even if they are set via flags?
file, err := os.Open(cfgFile)
if err != nil {
gologger.Fatal().Msgf("Could not open config file: %s\n", err)
@ -596,7 +596,8 @@ Additional documentation is available at: https://docs.nuclei.sh/getting-started
variables := data["var"]
if variables != nil {
for _, value := range variables.([]interface{}) {
if varSlice, ok := variables.([]interface{}); ok {
for _, value := range varSlice {
if strVal, ok := value.(string); ok {
options.Vars.Set(strVal)
} else {
@ -606,6 +607,7 @@ Additional documentation is available at: https://docs.nuclei.sh/getting-started
} else {
gologger.Warning().Msgf("No 'var' section found in config file: %s", cfgFile)
}
}
}
}