feat: add configuration option to bind server to specific address (#2165)

This commit is contained in:
Sandu Liviu Catalin
2023-08-24 04:59:23 +03:00
committed by GitHub
parent b9b795bf0e
commit 6c01e84099
3 changed files with 17 additions and 3 deletions

View File

@@ -139,7 +139,7 @@ func (s *Server) Start(ctx context.Context) error {
go s.backupRunner.Run(ctx)
// Start gRPC server.
listen, err := net.Listen("tcp", fmt.Sprintf(":%d", s.Profile.Port+1))
listen, err := net.Listen("tcp", fmt.Sprintf("%s:%d", s.Profile.Addr, s.Profile.Port+1))
if err != nil {
return err
}
@@ -152,7 +152,7 @@ func (s *Server) Start(ctx context.Context) error {
// programmatically set API version same as the server version
apiv1.SwaggerInfo.Version = s.Profile.Version
return s.e.Start(fmt.Sprintf(":%d", s.Profile.Port))
return s.e.Start(fmt.Sprintf("%s:%d", s.Profile.Addr, s.Profile.Port))
}
func (s *Server) Shutdown(ctx context.Context) {