Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions backend/gopkgs/launcher/launcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ import (
)

type Launcher struct {
app *kratos.App
app *kratos.App
notNeedServiceDiscovery bool

configOptions []config.Option
configWatchMap map[string]config.Observer
Expand Down Expand Up @@ -132,9 +133,11 @@ func (l *Launcher) newKratosApp() {
options = append(options, l.kratosOptions...)
}

consulClient := consulx.GetClient(context.Background())
consulReg := consul.New(consulClient)
options = append(options, kratos.Registrar(consulReg))
if !l.notNeedServiceDiscovery {
consulClient := consulx.GetClient(context.Background())
consulReg := consul.New(consulClient)
options = append(options, kratos.Registrar(consulReg))
}

value := l.config.Value("app")
appConfig := &App{}
Expand Down
6 changes: 6 additions & 0 deletions backend/gopkgs/launcher/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,9 @@ func WithLogger(logger log.Logger) Option {
l.logger = logger
}
}

func WithoutServiceDiscovery() Option {
return func(l *Launcher) {
l.notNeedServiceDiscovery = true
}
}