Skip to content

Commit

Permalink
fix: make sure files embedded during build
Browse files Browse the repository at this point in the history
  • Loading branch information
Ja7ad committed Jun 29, 2024
1 parent a1fe02a commit fd6f6aa
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions www/grpc/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,16 @@ type GatewayConfig struct {

// getOpenAPIHandler serves an OpenAPI UI.
func (*Server) getOpenAPIHandler() (http.Handler, error) {
swagger, err := fs.Sub(swaggerFS, "swaggerFS-ui")
if err != nil {
return nil, err
if _, err := swaggerFS.ReadFile("swagger-ui/index.html"); err == nil {
swagger, err := fs.Sub(swaggerFS, "swagger-ui")
if err != nil {
return nil, err
}

return http.FileServer(http.FS(swagger)), nil
}

return http.FileServer(http.FS(swagger)), nil
return http.FileServer(http.Dir("swagger-ui")), nil
}

func (s *Server) startGateway(grpcAddr string) error {
Expand Down

0 comments on commit fd6f6aa

Please sign in to comment.