From 24d3342af224de891ada055f3320fcb4276321c5 Mon Sep 17 00:00:00 2001 From: rgarcia Date: Fri, 21 Aug 2015 19:18:30 +0200 Subject: [PATCH] uses server_name from secrets --- config/deploy/shared/secrets.yml.erb | 1 + config/environments/production.rb | 7 +------ config/environments/staging.rb | 7 +------ 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/config/deploy/shared/secrets.yml.erb b/config/deploy/shared/secrets.yml.erb index d3c3251af..a1cc29fb8 100644 --- a/config/deploy/shared/secrets.yml.erb +++ b/config/deploy/shared/secrets.yml.erb @@ -2,3 +2,4 @@ recaptcha_public_key: <%= ENV["MADRID_RECAPTCHA_PUBLIC_KEY"] %> recaptcha_private_key: <%= ENV["MADRID_RECAPTCHA_PRIVATE_KEY"] %> secret_key_base: <%= ENV["SECRET_KEY_BASE"] %> + server_name: <%= fetch(:server_name) %> \ No newline at end of file diff --git a/config/environments/production.rb b/config/environments/production.rb index 2b85ff8fb..c8b1b8653 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -1,8 +1,3 @@ -def deploysecret(key) - @deploy_secrets_yml ||= YAML.load_file('config/deploy-secrets.yml')['production'] - @deploy_secrets_yml[key.to_s] -end - Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. @@ -68,7 +63,7 @@ Rails.application.configure do # Ignore bad email addresses and do not raise email delivery errors. # Set this to true and configure the email server for immediate delivery to raise delivery errors. config.action_mailer.raise_delivery_errors = true - config.action_mailer.default_url_options = { host: deploysecret(:server_name) } + config.action_mailer.default_url_options = { host: Rails.application.secrets.server_name } # Enable locale fallbacks for I18n (makes lookups for any locale fall back to # the I18n.default_locale when a translation cannot be found). diff --git a/config/environments/staging.rb b/config/environments/staging.rb index d8a33ad35..c8b1b8653 100644 --- a/config/environments/staging.rb +++ b/config/environments/staging.rb @@ -1,8 +1,3 @@ -def deploysecret(key) - @deploy_secrets_yml ||= YAML.load_file('config/deploy-secrets.yml')['staging'] - @deploy_secrets_yml[key.to_s] -end - Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. @@ -68,7 +63,7 @@ Rails.application.configure do # Ignore bad email addresses and do not raise email delivery errors. # Set this to true and configure the email server for immediate delivery to raise delivery errors. config.action_mailer.raise_delivery_errors = true - config.action_mailer.default_url_options = { host: deploysecret(:server_name) } + config.action_mailer.default_url_options = { host: Rails.application.secrets.server_name } # Enable locale fallbacks for I18n (makes lookups for any locale fall back to # the I18n.default_locale when a translation cannot be found).