upadted to 1.24.0; fixed stb and spiddped doubles in precene
This commit is contained in:
@@ -3,7 +3,10 @@ package scraper
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/iancoleman/strcase"
|
||||
"github.com/logrusorgru/aurora/v4"
|
||||
"github.com/spf13/viper"
|
||||
"golang.org/x/exp/slices"
|
||||
|
||||
"git.amok.space/yevhen/resource-scraper/internal/db"
|
||||
"git.amok.space/yevhen/resource-scraper/pkg/handler"
|
||||
@@ -12,8 +15,22 @@ import (
|
||||
"git.amok.space/yevhen/resource-scraper/types/constant"
|
||||
)
|
||||
|
||||
func isAllowScope() bool {
|
||||
scopesAllow := viper.GetStringSlice("scope.allow")
|
||||
scopeEnabled := viper.GetString(constant.FlagScopeEnable)
|
||||
|
||||
return slices.Contains(scopesAllow, scopeEnabled)
|
||||
}
|
||||
|
||||
func init() {
|
||||
strcase.ConfigureAcronym("stb", "STB")
|
||||
}
|
||||
|
||||
func Bootstrap() {
|
||||
//https://ahmadrosid.com/blog/how-to-query-html-dom-in-golang
|
||||
if !isAllowScope() {
|
||||
fmt.Printf("%s You are in not allowed scope, check %s config file\n", aurora.BgMagenta("[WARN]"), aurora.Magenta("default.yaml"))
|
||||
return
|
||||
}
|
||||
|
||||
dbase := db.New()
|
||||
repos := repository.New(dbase)
|
||||
@@ -23,10 +40,8 @@ func Bootstrap() {
|
||||
switch viper.GetString("role") {
|
||||
case constant.RoleConsole:
|
||||
fmt.Printf("init console console: %s\n", handlers.InitConsole())
|
||||
break
|
||||
case constant.RoleWeb:
|
||||
fmt.Printf("who: %s\n", handlers.InitRoutes())
|
||||
///http.Run()
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user