rubyconfig / config

Easiest way to add multi-environment yaml settings to Rails, Sinatra, Padrino and other Ruby projects.
Other
2.1k stars 230 forks source link

Add rails credentials support #355

Open noxasch opened 6 months ago

noxasch commented 6 months ago

Added rails credentials support with config flag addressing #68

noxasch commented 6 months ago

I'm currently having trouble with different ruby version in the test, any clue ?

cjlarose commented 6 months ago

Not 100% sure what's going on with the tests on CI. Tests pass for me locally. I suspect it has something to do with Rails 7.0 or 7.1 because we don't run tests for those Rails versions when running the test suite for Ruby 2.7, jruby, or truffleruby.

I merged in a change that address the deprecation warnings for fixture_path in Rails 7.1 to help clear up the test output. Hoping that will help clear things up 🤞

noxasch commented 6 months ago

Update:

Rebased to latest master

I look around and found the solution for rails 7.1 fail test. For Rails 7.1 and above it seems we need to use ActiveSupport::EncryptedConfiguration config method instead. But prior 7.1, Rails.credentials.to_h and Rails.secret.to_h will work just fine.

All test should pass now.

noxasch commented 6 months ago

Update:

  1. Addressed the changes and refactor the code.
  2. Update the crendentails to include the aws patter below to be more realistic
    aws:
    secret_access_key: '123456'

Apparently we don't need to check for rails version, just need to require the master_key in test environment and for rails5.2 untiil 6.1 need test.key and master.key, otherwise it somehow ignore the RAILS_MASTER_KEY in environment variable

noxasch commented 4 months ago

@cjlarose let me know if there is anything else require.

nickpoorman commented 1 week ago

@cjlarose @noxasch can we please get this merged? Thanks!