package handler import ( "fmt" "slices" "github.com/logrusorgru/aurora/v4" "github.com/spf13/viper" ) func (h *Handler) Console() string { viper.SetDefault("env", "devel") cmd := viper.GetString("create") cmdList := viper.Sub("console.cmd") allowCreate := cmdList.GetStringSlice("create") if !slices.Contains(allowCreate, cmd) { fmt.Printf("%s Not allowed command %s used\n", aurora.BgMagenta("[WARN]"), aurora.Magenta(cmd)) return "" } fmt.Printf("%v\n", slices.Contains(allowCreate, cmd)) return viper.GetString("env") }