From c015b30e6094d1400226bc1357db01a1af7b70d0 Mon Sep 17 00:00:00 2001 From: Gregor Destree Date: Thu, 7 Jun 2018 14:24:19 -0400 Subject: [PATCH 1/3] Edited the if statement --- config/initializers/recaptcha.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/initializers/recaptcha.rb b/config/initializers/recaptcha.rb index 6d610a9010..25cd2e176b 100644 --- a/config/initializers/recaptcha.rb +++ b/config/initializers/recaptcha.rb @@ -1,5 +1,5 @@ # config/initializers/recaptcha.rb -if Rails.env == "production" +if Rails.env.production? Recaptcha.configure do |config| config.site_key = '6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI' config.secret_key = '6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe' From a6e5da227ed28d523e238aaa259e52871b0309d5 Mon Sep 17 00:00:00 2001 From: Gregor Destree Date: Thu, 7 Jun 2018 14:40:36 -0400 Subject: [PATCH 2/3] Added the env variables --- config/initializers/recaptcha.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/initializers/recaptcha.rb b/config/initializers/recaptcha.rb index 25cd2e176b..e556dd6f89 100644 --- a/config/initializers/recaptcha.rb +++ b/config/initializers/recaptcha.rb @@ -1,8 +1,8 @@ # config/initializers/recaptcha.rb if Rails.env.production? Recaptcha.configure do |config| - config.site_key = '6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI' - config.secret_key = '6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe' + config.site_key = ENV.fetch("RECAPTCHA_SITE_KEY") + config.secret_key = ENV.fetch("RECAPTCHA_SECRET_KEY") # Uncomment the following line if you are using a proxy server: # config.proxy = 'http://myproxy.com.au:8080' end From 2548b428a91ad63be30229d742eda1c6267cae55 Mon Sep 17 00:00:00 2001 From: Gregor Destree Date: Thu, 7 Jun 2018 15:17:50 -0400 Subject: [PATCH 3/3] Edited ENV variable, and added fallback --- config/initializers/recaptcha.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/initializers/recaptcha.rb b/config/initializers/recaptcha.rb index e556dd6f89..f3e388ec07 100644 --- a/config/initializers/recaptcha.rb +++ b/config/initializers/recaptcha.rb @@ -1,8 +1,8 @@ # config/initializers/recaptcha.rb if Rails.env.production? Recaptcha.configure do |config| - config.site_key = ENV.fetch("RECAPTCHA_SITE_KEY") - config.secret_key = ENV.fetch("RECAPTCHA_SECRET_KEY") + config.site_key = ENV["RECAPTCHA_SITE_KEY"] || '6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI' + config.secret_key = ENV["RECAPTCHA_SECRET_KEY"] || '6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe' # Uncomment the following line if you are using a proxy server: # config.proxy = 'http://myproxy.com.au:8080' end