Skip to content

Commit

Permalink
Merge pull request #83 from 3scale/openshift-services
Browse files Browse the repository at this point in the history
[fetch] detect when running on openshift and use services instead of routes
  • Loading branch information
mikz authored Feb 21, 2018
2 parents c9114b9 + 3ffdbb0 commit e21d6b1
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions app/adapters/three_scale/api/instrumented_http_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,20 @@
# Custom HTTP Client for 3scale API client with added instrumentation.,
class ThreeScale::API::InstrumentedHttpClient < ThreeScale::API::HttpClient

def initialize(**)
super

if (system_provider_port = ENV['SYSTEM_PROVIDER_PORT'].presence)
proxy = URI(system_provider_port).freeze

@http = Net::HTTP.new(proxy.host, proxy.port)
@http.set_debug_output($stdout) if debug?

@headers = headers.merge('X-Forwarded-Host' => admin_domain,
'X-Forwarded-Proto' => endpoint.scheme)
end
end

def get(path, params: nil)
req = build_request(Net::HTTP::Get, path, params)
parse request(req, params: params)
Expand Down

0 comments on commit e21d6b1

Please sign in to comment.