rails-secrets
rails-secrets copied to clipboard
Make it rails 3.2.11 compatible.
Rails 3.2 uses to store the secret_key the config secret_token. So I extended the initializer. Can you merge it?
Thanks in advance.
Hmm, I don't think we should set both - we should try to do some feature detection. I think Rails 4 had a backwards compatible mode for secret_token - maybe you can look at that as a starting point?
Ok, I'll give it another shot. I thought I'll push it cause of the working tests. Maybe your test should also receive an update. Cause my rails app where I integrated the gem crashed after the first request had to be made.
@raskhadafi yes, please do update the tests - if you want to you could adapt them to use the appraisal gem to make sure it works across both 3.2 and 4.0.
I did a little research and in the rails guides under the point 4.7 Action Pack they recommend to set both.
# config/initializers/secret_token.rb
Myapp::Application.config.secret_token = 'existing secret token'
Myapp::Application.config.secret_key_base = 'new secret key base'
So my solution should work. What do you think @pixeltrix ?
An alternate solution would be to change the railtie to use before_initialize, then we could modify our 3.2 secret_token.rb to
RailsFrontend::Application.config.secret_token = RailsFrontend::Application.config.secret_key_base
@pixeltrix I could do a pull request for the change if your interested.