Japanese translator turned software engineer. I work mostly with Ruby and Rails, but love working on both the backend and the frontend. Currently a computer science student @ University of Colorado.
Location
Connecticut
Education
University of Colorado, Ohio State University, IUC (for Japanese)
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!
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
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 system is 4.1.11 ( because app which I use, can run under rails 4.xx only)
So I cannot use credentials.yml.enc file
Instead of credentials.yml.enc I should use another secret file (for example , secret_key_base )
But I do not know how to change the line to make the program work normally in ApplicationController.
I'm sorry, please teach me.
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 seeRails.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 likeENV['SECRET_KEY']
.Hope that helps a little bit >< Sorry I don't know enough about the Rails 4 way to do it!