'GraphQL Mesh dynamic endpoints and non local protofiles

I designed a microservice system and now I need to create the data layer. I chose GraphQL Mesh to implement it.


First Problem

In the system there is a "load balancer service" that chooses which gRPC service, REST API or GraphQL API should accept the request. But GraphQL Mesh accepts only one endpoint for each handler:

.meshrc.yml :

sources:
  - name: User
    handler:
      grpc:
        endpoint: 127.0.0.1:50051
        protoFilePath:
          file: ./contracts/proto/user.proto
          load:
            includeDirs:
              - ./contracts/proto

How can I make the endpoints dynamic by using the load balancer service?


Second Problem

In the system there is a "contract manager service" (REST API) that keeps the proto files or OpenAPI documents for using in other services.

Is there anyway to use this service to assign to protoFilePath or source of OpenAPI handler? or I just have to create a function to fetch contracts from repository and store them locally?


Please let me know if you have any other suggestion to implement the data layer of this system. Thank you.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source