Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore:add graphql server listen address config #1327

Merged
merged 3 commits into from
Apr 27, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 3 additions & 1 deletion gql/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ func (s *Server) Start(ctx context.Context) error {

// Serve dummy deals
port := int(s.resolver.cfg.Graphql.Port)
bindAddress := s.resolver.cfg.Graphql.ListenAddress

err = serveDummyDeals(mux, port)
if err != nil {
return err
Expand All @@ -72,7 +74,7 @@ func (s *Server) Start(ctx context.Context) error {
}
wsHandler := graphqlws.NewHandlerFunc(schema, queryHandler, wsOpts...)

listenAddr := fmt.Sprintf(":%d", port)
listenAddr := fmt.Sprintf("%s:%d", bindAddress, port)
s.srv = &http.Server{Addr: listenAddr, Handler: mux}
fmt.Printf("Graphql server listening on %s\n", listenAddr)
mux.Handle("/graphql/subscription", &corsHandler{wsHandler})
Expand Down
3 changes: 2 additions & 1 deletion node/config/def.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ func DefaultBoost() *Boost {
},

Graphql: GraphqlConfig{
Port: 8080,
ListenAddress: "127.0.0.1",
rickiey marked this conversation as resolved.
Show resolved Hide resolved
Port: 8080,
},

Tracing: TracingConfig{
Expand Down
2 changes: 2 additions & 0 deletions node/config/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ type WalletsConfig struct {
}

type GraphqlConfig struct {
// ListenAddress: default: 127.0.0.1
rickiey marked this conversation as resolved.
Show resolved Hide resolved
ListenAddress string
// The port that the graphql server listens on
Port uint64
}
Expand Down