Skip to content

Settings are loaded before setup block executed #244

@supremebeing7

Description

@supremebeing7

Version 2.0.0

I'm trying to use the use_env setting, but was noticing the override wasn't working. On closer inspection, it appears as if all of my settings are loaded prior to the Config.setup block being executed. I verified this by checking it in the initializer:

Config.setup do |config|
  config.const_name = 'Settings'
  config.use_env = true
  config.env_prefix = 'SETTINGS'
  config.env_separator = '__'
  config.env_converter = :downcase
  config.env_parse_values = true
end

puts ENV['SETTINGS__FOO']
# => baz

puts Settings.foo
# => bar

Settings.reload!

puts Settings.foo
# => baz

Has anyone else experienced this? I don't think it's due to any special setup for my particular app, but will try to spin up an example app to test.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions