1. fix repeat init api module

2. add custom config file flag
This commit is contained in:
陈景阳
2022-01-03 19:27:29 +08:00
parent b2ad543de3
commit f18b6b57e8
5 changed files with 28 additions and 29 deletions

View File

@@ -74,6 +74,6 @@ func NewApi() *Api {
api := &Api{
app: gin.New(),
}
api.Init()
// api.Init()
return api
}

View File

@@ -30,6 +30,7 @@ func Execute() error {
func init() {
cobra.OnInitialize(initConfig)
rootCmd.PersistentFlags().StringVar(&cfgFile, "c", "", "Use Custom Config File")
}
func initConfig() {

View File

@@ -2,12 +2,17 @@ module crawlab
go 1.16
require (
github.com/apex/log v1.9.0
github.com/crawlab-team/crawlab-core v0.6.0-beta.20211230.1200
github.com/crawlab-team/go-trace v0.1.1
github.com/gin-gonic/gin v1.7.1
github.com/spf13/cobra v1.1.3
github.com/spf13/viper v1.7.1
go.uber.org/dig v1.10.0
replace (
github.com/crawlab-team/crawlab-core => /Users/chenjingyang/dev/my-job/gitee/crawlab-core
github.com/crawlab-team/goseaweedfs => /Users/chenjingyang/dev/my-job/gitee/goseaweedfs
)
require (
github.com/apex/log v1.9.0
github.com/crawlab-team/crawlab-core v0.6.0-beta.20211230.1200
github.com/crawlab-team/go-trace v0.1.1
github.com/gin-gonic/gin v1.7.1
github.com/spf13/cobra v1.1.3
github.com/spf13/viper v1.7.1
go.uber.org/dig v1.10.0
)

View File

@@ -1,20 +0,0 @@
module crawlab
go 1.16
replace (
github.com/crawlab-team/crawlab-core => /libs/crawlab-team/crawlab-core
github.com/crawlab-team/crawlab-vcs => /libs/crawlab-team/crawlab-vcs
github.com/crawlab-team/crawlab-fs => /libs/crawlab-team/crawlab-fs
github.com/crawlab-team/crawlab-db => /libs/crawlab-team/crawlab-db
)
require (
github.com/apex/log v1.9.0
github.com/crawlab-team/crawlab-core v0.6.0-beta.20211219.2134
github.com/crawlab-team/go-trace v0.1.1
github.com/gin-gonic/gin v1.7.1
github.com/spf13/cobra v1.1.3
github.com/spf13/viper v1.7.1
go.uber.org/dig v1.10.0
)

13
backend/go.mod.remote Normal file
View File

@@ -0,0 +1,13 @@
module crawlab
go 1.16
require (
github.com/apex/log v1.9.0
github.com/crawlab-team/crawlab-core v0.6.0-beta.20211230.1200
github.com/crawlab-team/go-trace v0.1.1
github.com/gin-gonic/gin v1.7.1
github.com/spf13/cobra v1.1.3
github.com/spf13/viper v1.7.1
go.uber.org/dig v1.10.0
)