From 408198bcf70207f54adb354856fcb863c095b655 Mon Sep 17 00:00:00 2001 From: Tom Clegg Date: Sun, 3 Feb 2013 00:57:45 -0800 Subject: [PATCH] support user and API client using different URIs for same API endpoint --- app/models/orvos_api_client.rb | 6 +++++- config/environments/development.rb.example | 1 + config/environments/production.rb | 1 + config/environments/test.rb | 1 + 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/models/orvos_api_client.rb b/app/models/orvos_api_client.rb index 5249cd578c..417b1c2be2 100644 --- a/app/models/orvos_api_client.rb +++ b/app/models/orvos_api_client.rb @@ -68,7 +68,11 @@ class OrvosApiClient end def orvos_login_url(params={}) - uri = self.orvos_v1_base.sub(%r{/orvos/v\d+.*}, '/login') + if Rails.configuration.respond_to? :orvos_login_base + uri = Rails.configuration.orvos_login_base + else + uri = self.orvos_v1_base.sub(%r{/orvos/v\d+.*}, '/login') + end if params.size > 0 uri << '?' << params.collect { |k,v| CGI.escape(k.to_s) + '=' + CGI.escape(v.to_s) diff --git a/config/environments/development.rb.example b/config/environments/development.rb.example index e360169fe3..3a327d6261 100644 --- a/config/environments/development.rb.example +++ b/config/environments/development.rb.example @@ -35,6 +35,7 @@ Vcffarm::Application.configure do # Expands the lines which load the assets config.assets.debug = true + config.orvos_login_base = 'http://orvos.local/login' config.orvos_v1_base = 'http://orvos.local/orvos/v1' config.data_import_dir = '/data/vcffarm-upload' diff --git a/config/environments/production.rb b/config/environments/production.rb index bb7fd4505f..bab5968132 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -65,6 +65,7 @@ Vcffarm::Application.configure do # with SQLite, MySQL, and PostgreSQL) # config.active_record.auto_explain_threshold_in_seconds = 0.5 + config.orvos_login_base = 'https://9ujm1.orvosapi.com/login' config.orvos_v1_base = 'https://9ujm1.orvosapi.com/orvos/v1' config.data_import_dir = '/data/parabase-upload' diff --git a/config/environments/test.rb b/config/environments/test.rb index 88d0debebd..858d8e9510 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -35,6 +35,7 @@ Vcffarm::Application.configure do # Print deprecation notices to the stderr config.active_support.deprecation = :stderr + config.orvos_login_base = 'http://orvos/login' config.orvos_v1_base = 'https://orvos/orvos/v1' config.data_import_dir = '/data/vcffarm-upload' -- 2.30.2