From 1c5cd471cd41326ad781f33fb0d41ba4f9cb8b9c Mon Sep 17 00:00:00 2001 From: Xavier J Date: Thu, 1 Sep 2016 12:09:44 +0200 Subject: [PATCH] Externalize in config file SIADE API URL. --- config/deploy.rb | 1 + config/initializers/urls.rb | 5 +++++ lib/siade/api.rb | 6 +----- 3 files changed, 7 insertions(+), 5 deletions(-) create mode 100644 config/initializers/urls.rb diff --git a/config/deploy.rb b/config/deploy.rb index 4350ccd30..a40a9c2b6 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -68,6 +68,7 @@ set :shared_paths, [ 'config/initializers/features.yml', "config/environments/#{ENV['to']}.rb", "config/initializers/token.rb", + "config/initializers/urls.rb", "config/initializers/super_admin.rb", "config/unicorn.rb", "config/initializers/raven.rb", diff --git a/config/initializers/urls.rb b/config/initializers/urls.rb new file mode 100644 index 000000000..bb49d1437 --- /dev/null +++ b/config/initializers/urls.rb @@ -0,0 +1,5 @@ +if Rails.env.production? + SIADEURL = 'https://api.apientreprise.fr' +else + SIADEURL = 'https://api-dev.apientreprise.fr' +end \ No newline at end of file diff --git a/lib/siade/api.rb b/lib/siade/api.rb index 620c5f627..c182ab8c8 100644 --- a/lib/siade/api.rb +++ b/lib/siade/api.rb @@ -38,10 +38,6 @@ class SIADE::API end def self.base_url - if Rails.env.production? - 'https://api.apientreprise.fr' - else - 'https://api-dev.apientreprise.fr' - end + SIADEURL end end