diff --git a/gql/server.go b/gql/server.go index b6114c7ef..fc857057a 100644 --- a/gql/server.go +++ b/gql/server.go @@ -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 @@ -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}) diff --git a/node/config/def.go b/node/config/def.go index 1cd5bbc6b..6bb9df252 100644 --- a/node/config/def.go +++ b/node/config/def.go @@ -63,7 +63,8 @@ func DefaultBoost() *Boost { }, Graphql: GraphqlConfig{ - Port: 8080, + ListenAddress: "0.0.0.0", + Port: 8080, }, Tracing: TracingConfig{ diff --git a/node/config/types.go b/node/config/types.go index 631ec577f..92dfee938 100644 --- a/node/config/types.go +++ b/node/config/types.go @@ -73,6 +73,8 @@ type WalletsConfig struct { } type GraphqlConfig struct { + // The ip address the GraphQL server will bind to. Default: 0.0.0.0 + ListenAddress string // The port that the graphql server listens on Port uint64 }