Skip to content

Commit

Permalink
fix: fx bootstrap when telemetry is not enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
gfyrag committed Aug 5, 2022
1 parent b1821ea commit 8fd5aa7
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions cmd/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ var serveCmd = &cobra.Command{
return err
}

app := fx.New(
options := []fx.Option{
fx.Supply(fx.Annotate(cmd.Context(), fx.As(new(context.Context)))),
api.Module(baseUrl, ":8080"),
storage.Module(viper.GetString(postgresUriFlag), key),
Expand All @@ -76,12 +76,16 @@ var serveCmd = &cobra.Command{
delegatedClientSecret,
fmt.Sprintf("%s/delegatedoidc/callback", baseUrl),
),
sharedotlptraces.CLITracesModule(viper.GetViper()),
fx.Invoke(func() {
sharedlogging.Infof("App started.")
}),
fx.NopLogger,
)
}
if tm := sharedotlptraces.CLITracesModule(viper.GetViper()); tm != nil {
options = append(options, tm)
}

app := fx.New(options...)
err = app.Start(cmd.Context())
if err != nil {
return err
Expand Down

0 comments on commit 8fd5aa7

Please sign in to comment.