2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

[Rails 5.2] credentialsだとrecapchaの環境変数が読み込めない[memo]

2
Posted at

gemのrecapchaで必要なsitekeyとsecretkeyは環境変数から読み込まれますが、
credentialsなどは考慮されていないため、credentialsから環境変数を設定しました。

# vi config/initializer/recaptcha.rb

+ENV['RECAPTCHA_SITE_KEY']   = Rails.application.credentials.recaptcha[:site_key]
+ENV['RECAPTCHA_SECRET_KEY'] = Rails.application.credentials.recaptcha[:secret_key]

上記のようにすることで環境変数はcredentilasを利用しつつ、recapchaも使えるようになりました。

2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?