From de1bb93ebfa1f485bc15f0de622249f171fe1b5a Mon Sep 17 00:00:00 2001 From: Alexander Dischberg Date: Sun, 24 Mar 2024 20:18:53 +0800 Subject: [PATCH] refactor: load crendentials before env --- lib/config.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/config.rb b/lib/config.rb index 1bf22e48..addaf2e2 100644 --- a/lib/config.rb +++ b/lib/config.rb @@ -48,8 +48,7 @@ def self.load_files(*sources) config.add_source!(source) end - config.add_source!(Sources::EnvSource.new(ENV)) if Config.use_env - + # load rails crendentials if defined?(::Rails::Railtie) && Config.use_rails_credentials if Rails.application.credentials.respond_to?(:credentials) config.add_source!(Sources::HashSource.new(Rails.application.credentials.config.deep_stringify_keys)) @@ -58,6 +57,8 @@ def self.load_files(*sources) end end + config.add_source!(Sources::EnvSource.new(ENV)) if Config.use_env + config.load! config end