Skip to content

Commit

Permalink
use resolverOpts
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Siwiec <rizzza@users.noreply.github.com>
  • Loading branch information
rizzza committed Nov 16, 2023
1 parent fb6d4da commit b8f798d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions .devcontainer/.env
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ LOADBALANCERAPI_CRDB_URI="postgresql://root@crdb:26257/load_balancer_api_dev?ssl
LOADBALANCERAPI_EVENTS_NATS_CREDSFILE="/workspaces/load-balancer-api/.devcontainer/nsc/nkeys/creds/LOCAL/LBAAS/USER.creds"
LOADBALANCERAPI_EVENTS_NATS_PUBLISHPREFIX=com.infratographer
LOADBALANCERAPI_EVENTS_NATS_QUEUEGROUP=loadbalancerapi
LOADBALANCERAPI_PERMISSIONS_IGNORENORESPONDERS=true

NKEYS_PATH="/workspaces/load-balancer-api/.devcontainer/nsc/nkeys"
NSC_HOME="/workspaces/load-balancer-api/.devcontainer/nsc/nats"
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ services:
context: .
dockerfile: Dockerfile
args:
VARIANT: 1.20-bullseye
VARIANT: 1.21-bullseye
NODE_VERSION: "none"
# Overrides default command so things don't shut down after the process ends.
command: sleep infinity
Expand Down
9 changes: 8 additions & 1 deletion cmd/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ func writePidFile(pidFile string) error {
}

func serve(ctx context.Context) error {
var resolverOpts []graphapi.Option

if serveDevMode {
enablePlayground = true
config.AppConfig.Logging.Debug = true
Expand Down Expand Up @@ -172,6 +174,11 @@ func serve(ctx context.Context) error {
metadataClient = metadata.New(config.AppConfig.Supergraph.URL)
}
}

if metadataClient != nil {
resolverOpts = append(resolverOpts, graphapi.WithMetadataClient(metadataClient))
}

// TODO: fix generated pubsubhooks
// eventhooks.PubsubHooks(client)

Expand Down Expand Up @@ -213,7 +220,7 @@ func serve(ctx context.Context) error {

middleware = append(middleware, perms.Middleware())

r := graphapi.NewResolver(client, logger.Named("resolvers"), graphapi.WithMetadataClient(metadataClient))
r := graphapi.NewResolver(client, logger.Named("resolvers"), resolverOpts...)
handler := r.Handler(enablePlayground, middleware...)

srv.AddHandler(handler)
Expand Down

0 comments on commit b8f798d

Please sign in to comment.