Skip to content
loading...

re: Adding reCaptcha v3 to a Rails app without a gem VIEW POST

TOP OF THREAD FULL DISCUSSION
re: First of all thanks!! for helpful article for google reCaprcha v3 for rails.. I need some help to apply of this document... rails version of my s...
 

Hi there! Thank for reading!

Well, secrets from Rails' credential system are read with code that look like this (for example): Rails.application.credentials.dig(:recaptcha_secret_key). So, anywhere you see Rails.applications.credentials..., you need to replace it with how the other secret file like secret_key_base reads those variables. I'm not exactly sure how to do it for Rails 4 though, so you would need to research about that.

I have also used the dotenv gem before, which is very easy to use. You learn more about dotenv here. Basically, you make a file named .env and register any secret keys you need there. Then read them with something like ENV['SECRET_KEY'].

Hope that helps a little bit >< Sorry I don't know enough about the Rails 4 way to do it!

code of conduct - report abuse