Skip to content

Commit

Permalink
Don't include internal-frontend in default services if missing from c…
Browse files Browse the repository at this point in the history
…onfig
  • Loading branch information
dnr committed Jan 26, 2023
1 parent 5652dc4 commit 4390932
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions cmd/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import (
_ "time/tzdata" // embed tzdata as a fallback

"github.com/urfave/cli/v2"
"golang.org/x/exp/slices"

"go.temporal.io/server/common/authorization"
"go.temporal.io/server/common/build"
Expand All @@ -45,6 +46,7 @@ import (
_ "go.temporal.io/server/common/persistence/sql/sqlplugin/mysql" // needed to load mysql plugin
_ "go.temporal.io/server/common/persistence/sql/sqlplugin/postgresql" // needed to load postgresql plugin
_ "go.temporal.io/server/common/persistence/sql/sqlplugin/sqlite" // needed to load sqlite plugin
"go.temporal.io/server/common/primitives"
"go.temporal.io/server/temporal"
)

Expand Down Expand Up @@ -139,6 +141,15 @@ func buildCLI() *cli.App {
return cli.Exit(fmt.Sprintf("Unable to load configuration: %v.", err), 1)
}

if !c.IsSet("service") && !c.IsSet("services") {
if _, ok := cfg.Services[string(primitives.InternalFrontendService)]; !ok {
// --services is using default value (all services) but internal-frontend
// is missing from config. in that case, remove it.
i := slices.Index(services, string(primitives.InternalFrontendService))
services = slices.Delete(services, i, i+1)
}
}

logger := log.NewZapLogger(log.BuildZapLogger(cfg.Log))
logger.Info("Build info.",
tag.NewTimeTag("git-time", build.InfoData.GitTime),
Expand Down

0 comments on commit 4390932

Please sign in to comment.