Skip to content

Commit

Permalink
fix: update credentials
Browse files Browse the repository at this point in the history
  • Loading branch information
noxasch committed May 16, 2024
1 parent 5c51e58 commit 40dcc07
Show file tree
Hide file tree
Showing 13 changed files with 22 additions and 15 deletions.
6 changes: 3 additions & 3 deletions lib/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ def self.load_files(*sources)
config.add_source!(Sources::EnvSource.new(ENV)) if Config.use_env

if defined?(::Rails::Railtie) && Config.use_rails_credentials
if Gem::Version.new(Rails.version) < Gem::Version.new('6.0.0')
config.add_source!(Sources::HashSource.new(Rails.application.secrets.to_h.deep_stringify_keys))
else
if Rails.application.credentials.respond_to?(:credentials)
config.add_source!(Sources::HashSource.new(Rails.application.credentials.config.deep_stringify_keys))
else
config.add_source!(Sources::HashSource.new(Rails.application.secrets.to_h.deep_stringify_keys))
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/app/rails_5.2/config/credentials.yml.enc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
KwL0rruFDlmLeUTYjFW9SLuKTECmDC5yFnbDxeycOWkY+ticpqhLA8THvEEB8FBcg+Nnav0GLRIzDeIgaYnKjgZc5zSW6401woes2opH56R+lChpwlMJXjUCuBVw5XTdOLjMxcwAYTZYSQ==--JfIMmHZO5SGdk53K--jbfjYwi3uFD6EVuVdG6TvA==
eeAQ/OXwC0m/AFe89iINCTXiXfUjEJT0hjQsUdyyR1vH0Z7PxXuMiceL1zms6vjCex9kUIL6PBnaB0QZhWOn9DOEmXF67+1nzvJ5SCTuk33fHouECBHxcRbiIqL2/DtLWq+E49mPdJFL85qZPqfQbNhvVeH7E/kjOFU700KENA1+XDMnmoGRW1ePbDhKSNvsPHRZAX6I4ZirJlYvN9IcN29CTLoYPtcm8J1DAtpTZIlJ+XLgOeJJC606I6WMKcz4wgGl9u7+4q/poP63aUnWgpcagn2MGrVz7GnOdkYIGnapvcr56FesEU8pNjTPrtlCdwU8--hQYbWSSJlVbedEFS--NRIGzBPS6ZyZWUO/8clKpg==
2 changes: 2 additions & 0 deletions spec/app/rails_5.2/config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
# preloads Rails for running tests, you may have to set it to true.
config.eager_load = false

config.require_master_key = true

# Configure public file server for tests with Cache-Control for performance.
config.public_file_server.enabled = true
config.public_file_server.headers = {
Expand Down
1 change: 1 addition & 0 deletions spec/app/rails_5.2/config/master.key
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0e29551e5c31acf7c769d64397af54e4
2 changes: 1 addition & 1 deletion spec/app/rails_6.0/config/credentials.yml.enc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
PaXkA1XvCoD2qMPBVqHDcwGTtDN1gPdMjTkQlR8ULG97mJGnwirXG3zYhSmSE/gUsGgpPNOSIVJzVr8ZhvO1EVR6UMCIVMf0oE1kCtES0gD5JA4wi0jrrE7v0zA0lmIheJRvwb/DSGPKayviZn0md9AdfQyneHOGwDF/PrxkSrs6S/YPz/444dex3GUlKUuBduyGzxTEPs+v8if7CP4pK1qSxt2AM+7lDnr4mFp6lpmfIgeloqF/M0opyVnwnZtzGWzm7rOTntyKBeIN0FlXgRMVhQcZy3PstILHqGMygT+xCD0ZDLQnWziMYmkWaJlNdJvoI6mS2OEONqICDv3C3KT5gdQ6Fe8fgtxFzkR6evOJKJ0a5IX/QEjcNBNj/1+uPyWrk+NauQt4m3c9KIFFmyqZLVU/5NEJPS/d--DP0Q5D3FxFw7oxNZ--/ERbqGg48aYyZeYVnk5STw==
eeAQ/OXwC0m/AFe89iINCTXiXfUjEJT0hjQsUdyyR1vH0Z7PxXuMiceL1zms6vjCex9kUIL6PBnaB0QZhWOn9DOEmXF67+1nzvJ5SCTuk33fHouECBHxcRbiIqL2/DtLWq+E49mPdJFL85qZPqfQbNhvVeH7E/kjOFU700KENA1+XDMnmoGRW1ePbDhKSNvsPHRZAX6I4ZirJlYvN9IcN29CTLoYPtcm8J1DAtpTZIlJ+XLgOeJJC606I6WMKcz4wgGl9u7+4q/poP63aUnWgpcagn2MGrVz7GnOdkYIGnapvcr56FesEU8pNjTPrtlCdwU8--hQYbWSSJlVbedEFS--NRIGzBPS6ZyZWUO/8clKpg==
2 changes: 1 addition & 1 deletion spec/app/rails_6.0/config/credentials/test.yml.enc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
m3lysAv8wqGjFAsBDZ4YvmZfbwUKEi7umoQungfPdOGS9AvPvlyCzc6WZZxD47zeEUUYGA2N9ZsKtyZSotx1A1EABrosT5lGmBkdlFHAw03CPIlYNllt+b4fGPtWEJRo--LDfMlQx4Y/bRk8vp--dfNGYxQFI7KUBKnUU5efcA==
eeAQ/OXwC0m/AFe89iINCTXiXfUjEJT0hjQsUdyyR1vH0Z7PxXuMiceL1zms6vjCex9kUIL6PBnaB0QZhWOn9DOEmXF67+1nzvJ5SCTuk33fHouECBHxcRbiIqL2/DtLWq+E49mPdJFL85qZPqfQbNhvVeH7E/kjOFU700KENA1+XDMnmoGRW1ePbDhKSNvsPHRZAX6I4ZirJlYvN9IcN29CTLoYPtcm8J1DAtpTZIlJ+XLgOeJJC606I6WMKcz4wgGl9u7+4q/poP63aUnWgpcagn2MGrVz7GnOdkYIGnapvcr56FesEU8pNjTPrtlCdwU8--hQYbWSSJlVbedEFS--NRIGzBPS6ZyZWUO/8clKpg==
2 changes: 2 additions & 0 deletions spec/app/rails_6.0/config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
# preloads Rails for running tests, you may have to set it to true.
config.eager_load = false

config.require_master_key = true

# Configure public file server for tests with Cache-Control for performance.
config.public_file_server.enabled = true
config.public_file_server.headers = {
Expand Down
2 changes: 1 addition & 1 deletion spec/app/rails_6.1/config/credentials.yml.enc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
m3lysAv8wqGjFAsBDZ4YvmZfbwUKEi7umoQungfPdOGS9AvPvlyCzc6WZZxD47zeEUUYGA2N9ZsKtyZSotx1A1EABrosT5lGmBkdlFHAw03CPIlYNllt+b4fGPtWEJRo--LDfMlQx4Y/bRk8vp--dfNGYxQFI7KUBKnUU5efcA==
eeAQ/OXwC0m/AFe89iINCTXiXfUjEJT0hjQsUdyyR1vH0Z7PxXuMiceL1zms6vjCex9kUIL6PBnaB0QZhWOn9DOEmXF67+1nzvJ5SCTuk33fHouECBHxcRbiIqL2/DtLWq+E49mPdJFL85qZPqfQbNhvVeH7E/kjOFU700KENA1+XDMnmoGRW1ePbDhKSNvsPHRZAX6I4ZirJlYvN9IcN29CTLoYPtcm8J1DAtpTZIlJ+XLgOeJJC606I6WMKcz4wgGl9u7+4q/poP63aUnWgpcagn2MGrVz7GnOdkYIGnapvcr56FesEU8pNjTPrtlCdwU8--hQYbWSSJlVbedEFS--NRIGzBPS6ZyZWUO/8clKpg==
2 changes: 1 addition & 1 deletion spec/app/rails_6.1/config/credentials/test.yml.enc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
m3lysAv8wqGjFAsBDZ4YvmZfbwUKEi7umoQungfPdOGS9AvPvlyCzc6WZZxD47zeEUUYGA2N9ZsKtyZSotx1A1EABrosT5lGmBkdlFHAw03CPIlYNllt+b4fGPtWEJRo--LDfMlQx4Y/bRk8vp--dfNGYxQFI7KUBKnUU5efcA==
eeAQ/OXwC0m/AFe89iINCTXiXfUjEJT0hjQsUdyyR1vH0Z7PxXuMiceL1zms6vjCex9kUIL6PBnaB0QZhWOn9DOEmXF67+1nzvJ5SCTuk33fHouECBHxcRbiIqL2/DtLWq+E49mPdJFL85qZPqfQbNhvVeH7E/kjOFU700KENA1+XDMnmoGRW1ePbDhKSNvsPHRZAX6I4ZirJlYvN9IcN29CTLoYPtcm8J1DAtpTZIlJ+XLgOeJJC606I6WMKcz4wgGl9u7+4q/poP63aUnWgpcagn2MGrVz7GnOdkYIGnapvcr56FesEU8pNjTPrtlCdwU8--hQYbWSSJlVbedEFS--NRIGzBPS6ZyZWUO/8clKpg==
2 changes: 2 additions & 0 deletions spec/app/rails_6.1/config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
# preloads Rails for running tests, you may have to set it to true.
config.eager_load = false

config.require_master_key = true

# Configure public file server for tests with Cache-Control for performance.
config.public_file_server.enabled = true
config.public_file_server.headers = {
Expand Down
2 changes: 1 addition & 1 deletion spec/app/rails_7.0/config/credentials/test.yml.enc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
m3lysAv8wqGjFAsBDZ4YvmZfbwUKEi7umoQungfPdOGS9AvPvlyCzc6WZZxD47zeEUUYGA2N9ZsKtyZSotx1A1EABrosT5lGmBkdlFHAw03CPIlYNllt+b4fGPtWEJRo--LDfMlQx4Y/bRk8vp--dfNGYxQFI7KUBKnUU5efcA==
eeAQ/OXwC0m/AFe89iINCTXiXfUjEJT0hjQsUdyyR1vH0Z7PxXuMiceL1zms6vjCex9kUIL6PBnaB0QZhWOn9DOEmXF67+1nzvJ5SCTuk33fHouECBHxcRbiIqL2/DtLWq+E49mPdJFL85qZPqfQbNhvVeH7E/kjOFU700KENA1+XDMnmoGRW1ePbDhKSNvsPHRZAX6I4ZirJlYvN9IcN29CTLoYPtcm8J1DAtpTZIlJ+XLgOeJJC606I6WMKcz4wgGl9u7+4q/poP63aUnWgpcagn2MGrVz7GnOdkYIGnapvcr56FesEU8pNjTPrtlCdwU8--hQYbWSSJlVbedEFS--NRIGzBPS6ZyZWUO/8clKpg==
2 changes: 1 addition & 1 deletion spec/app/rails_7.1/config/credentials/test.yml.enc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
m3lysAv8wqGjFAsBDZ4YvmZfbwUKEi7umoQungfPdOGS9AvPvlyCzc6WZZxD47zeEUUYGA2N9ZsKtyZSotx1A1EABrosT5lGmBkdlFHAw03CPIlYNllt+b4fGPtWEJRo--LDfMlQx4Y/bRk8vp--dfNGYxQFI7KUBKnUU5efcA==
eeAQ/OXwC0m/AFe89iINCTXiXfUjEJT0hjQsUdyyR1vH0Z7PxXuMiceL1zms6vjCex9kUIL6PBnaB0QZhWOn9DOEmXF67+1nzvJ5SCTuk33fHouECBHxcRbiIqL2/DtLWq+E49mPdJFL85qZPqfQbNhvVeH7E/kjOFU700KENA1+XDMnmoGRW1ePbDhKSNvsPHRZAX6I4ZirJlYvN9IcN29CTLoYPtcm8J1DAtpTZIlJ+XLgOeJJC606I6WMKcz4wgGl9u7+4q/poP63aUnWgpcagn2MGrVz7GnOdkYIGnapvcr56FesEU8pNjTPrtlCdwU8--hQYbWSSJlVbedEFS--NRIGzBPS6ZyZWUO/8clKpg==
10 changes: 5 additions & 5 deletions spec/config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -481,16 +481,16 @@

end

context 'rails crendentials' do
context 'rails credentials' do
if defined?(::Rails)
let(:config) do
files = ["#{fixture_path}/development.yml"]
Config.use_rails_credentials = true
Config.load_files(files)
end

it "shoud have secret_key_base loaded" do
expect(config.keys).to contain_exactly(:size, :section, :aws)
it "should have secret_key_base loaded" do
expect(config.keys).to contain_exactly(:size, :section, :aws, :secret_key_base)
expect(config.aws.secret_access_key).to eq('123456')
end

Expand All @@ -501,7 +501,7 @@
Config.load_files(files)
end

it "shoud not have secret_key_base loaded" do
it "should not have secret_key_base loaded" do
expect(config.keys).to contain_exactly(:size, :section)
end
end
Expand All @@ -515,7 +515,7 @@
Config.load_files(files)
end

it 'shoud not have secret_key_base loaded' do
it 'should not have secret_key_base loaded' do
expect(config.keys).to contain_exactly(:size, :section)
end
end
Expand Down

0 comments on commit 40dcc07

Please sign in to comment.