diff --git a/app/controllers/os_api_controller.rb b/app/controllers/os_api_controller.rb index 1a04619481..8516932a1e 100644 --- a/app/controllers/os_api_controller.rb +++ b/app/controllers/os_api_controller.rb @@ -41,7 +41,14 @@ def reverse_proxy # byebug # get api client for the given service name - service = services.os_api.service(service_name) + service = services.os_api.service(service_name,interface: "internal") + # check if internal interface is available + begin + service.endpoint_url(interface: "internal") + rescue Elektron::Errors::ServiceEndpointUnavailable + service = services.os_api.service(service_name,interface: "public") + end + # filter the relevant params for the api client elektron_params = request.query_parameters diff --git a/app/services/service_layer/os_api_service.rb b/app/services/service_layer/os_api_service.rb index c0d3a08f9c..4029bc913e 100644 --- a/app/services/service_layer/os_api_service.rb +++ b/app/services/service_layer/os_api_service.rb @@ -2,8 +2,8 @@ # Use case rever_proxy (see os_api_controller.rb) module ServiceLayer class OsApiService < Core::ServiceLayer::Service - def service(name) - elektron.service(name) + def service(name,options={}) + elektron.service(name,options) end end end