Skip to content

Using dotenv/load causes double loading (and logging) of env when using rails #547

Description

@fsateler

On a regular rails application, that requires dotenv/load, env is loaded twice: once at dotenv/load time and once at rails initialization.

% cat test.rb
require 'rails'
require 'dotenv/load'

require_relative 'config/environment'

% bundle exec ruby test.rb
[dotenv] Loaded .env.development.local
[dotenv] Loaded .env.development
[dotenv] Loaded .env.development.local
[dotenv] Loaded .env.development

I believe this is because the rails initializer is inconditional:

config.before_configuration { load }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions