From e22fe5cee2ec865e8513a47955ff872007a0cdee 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 dcf027a5..2f3a2760 100644 --- a/lib/config.rb +++ b/lib/config.rb @@ -47,8 +47,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)) @@ -57,6 +56,8 @@ def self.load_files(*sources) end end + config.add_source!(Sources::EnvSource.new(ENV)) if Config.use_env + config.load! config end