class Proxy::Dynflow::Api

Constants

TASK_UPDATE_REGEXP_PATH

Private Instance Methods

callback_host(params, request) click to toggle source
# File lib/smart_proxy_dynflow/api.rb, line 84
def callback_host(params, request)
  params.fetch('action_input', {})['proxy_url'] || callback_host_from_env(request)
end
callback_host_from_env(request) click to toggle source
# File lib/smart_proxy_dynflow/api.rb, line 88
def callback_host_from_env(request)
  protocol = %w[yes on 1].include?(request.env['HTTPS'].to_s) ? 'https' : 'http'
  host = request.env.values_at('HTTP_X_FORWARDED_FOR', 'HTTP_HOST').compact.first
  "#{protocol}://#{host}"
end
launcher_class(params) click to toggle source
# File lib/smart_proxy_dynflow/api.rb, line 94
def launcher_class(params)
  operation = params.fetch('operation')
  if TaskLauncherRegistry.key?(operation)
    TaskLauncherRegistry.fetch(operation)
  else
    halt 404, MultiJson.dump(:error => "Unknown operation '#{operation}' requested.")
  end
end