Skip to content

Commit

Permalink
feat: Server could disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
morlay committed Feb 29, 2024
1 parent 1c81c65 commit 9f36a4c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/configuration/lifecycle.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ func serve(ctx context.Context, stopCh chan os.Signal, configuratorServers ...Se
for i := range configuratorServers {
server := configuratorServers[i]

if d, ok := server.(CanDisabled); ok {
if d.Disabled(ctx) {
continue
}
}

g.Go(func() error {
err := server.Serve(c)
go func() {
Expand Down Expand Up @@ -158,3 +164,7 @@ type Server interface {
type CanShutdown interface {
Shutdown(ctx context.Context) error
}

type CanDisabled interface {
Disabled(ctx context.Context) bool
}

0 comments on commit 9f36a4c

Please sign in to comment.