1
0
Fork 0
mirror of https://github.com/mastodon/mastodon.git synced 2024-08-20 21:08:15 -07:00

Move hcaptcha service config to config_for yml

This commit is contained in:
Matt Jankowski 2024-06-11 15:52:31 -04:00
parent 82344342c1
commit d0a938d7e4
4 changed files with 7 additions and 2 deletions

View file

@ -10,7 +10,7 @@ module Auth::CaptchaConcern
end end
def captcha_available? def captcha_available?
ENV['HCAPTCHA_SECRET_KEY'].present? && ENV['HCAPTCHA_SITE_KEY'].present? Rails.configuration.x.captcha.secret_key.present? && Rails.configuration.x.captcha.site_key.present?
end end
def captcha_enabled? def captcha_enabled?

View file

@ -2,7 +2,7 @@
module Admin::SettingsHelper module Admin::SettingsHelper
def captcha_available? def captcha_available?
ENV['HCAPTCHA_SECRET_KEY'].present? && ENV['HCAPTCHA_SITE_KEY'].present? Rails.configuration.x.captcha.secret_key.present? && Rails.configuration.x.captcha.site_key.present?
end end
def login_activity_title(activity) def login_activity_title(activity)

View file

@ -112,6 +112,8 @@ module Mastodon
end end
end end
config.x.captcha = config_for(:captcha)
config.to_prepare do config.to_prepare do
Doorkeeper::AuthorizationsController.layout 'modal' Doorkeeper::AuthorizationsController.layout 'modal'
Doorkeeper::AuthorizedApplicationsController.layout 'admin' Doorkeeper::AuthorizedApplicationsController.layout 'admin'

3
config/captcha.yml Normal file
View file

@ -0,0 +1,3 @@
shared:
secret_key: <%= ENV.fetch('HCAPTCHA_SECRET_KEY', nil) %>
site_key: <%= ENV.fetch('HCAPTCHA_SITE_KEY', nil) %>