upadted to 1.24.0; fixed stb and spiddped doubles in precene
This commit is contained in:
26
pkg/handler/console.go
Normal file
26
pkg/handler/console.go
Normal file
@@ -0,0 +1,26 @@
|
||||
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")
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user