Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Currently we have hard-coded list of services in Client entity class, which is populated with initial bootstrap. This list is needed for oauth to authorize services that are using service-level tokens.


Proposed solution

The easiest way of retrieving list of registered services is to use Consul API. Consul has API to find all registered services. All of our services are registering with special tag, i.e. Referencedata, so we will need to filter those listed services using "openlmis-service" tag and use "Name" property. Looking into our configuration of Consul we need to send request on "server_address:8500/v1/catalog/services". Example of response: 

...

  1. Retrieve list of all registered services from Consul API.
  2. Filter this list to get only those which have "openlmis-service" tag (make note that some of services can be duplicated).
  3. Concatenate all filtered name using ',' .
  4. Save concatenate value to all records of Client class. 


Image Added