Skip to content

Commit

Permalink
Log what was loaded when Rails.logger is initialized
Browse files Browse the repository at this point in the history
  • Loading branch information
bkeepers committed Jan 21, 2024
1 parent a9a9335 commit 832ebbc
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/dotenv/rails.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@ def self.load
instance.load
end

# Rails.logger was not intialized when dotenv loaded. Wait until it is and log what happened.
initializer "dotenv", after: :initialize_logger do |app|
loaded_files = files.select(&:exist?).map { |p| p.relative_path_from(root).to_s }
::Rails.logger.debug "dotenv loaded ENV from #{loaded_files.to_sentence}"
end

initializer "dotenv.deprecator" do |app|
app.deprecators[:dotenv] = deprecator
end
Expand Down

0 comments on commit 832ebbc

Please sign in to comment.