Skip to content

Commit 8838cf2

Browse files
committed
Load Alchemy's config.yml before app initializers
Load Alchemy configuration from YAML files in config/alchemy/config.yml and config/alchemy/#{Rails.env}.config.yml f they exist. This has to be done before any app initializers are loaded, so that the configuration is available in all initializers.
1 parent 0268818 commit 8838cf2

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/alchemy/engine.rb

+6-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,12 @@ class Engine < Rails::Engine
9797
end
9898
end
9999

100-
initializer "alchemy.config_yml" do |app|
100+
# Load Alchemy configuration from YAML files
101+
# in config/alchemy/config.yml and config/alchemy/#{Rails.env}.config.yml
102+
# if they exist.
103+
# This has to be done before any app initializers are loaded, so that
104+
# the configuration is available in all initializers.
105+
initializer "alchemy.config_yml", before: :load_config_initializers do |app|
101106
config_directory = Rails.root.join("config", "alchemy")
102107
main_config = config_directory.join("config.yml")
103108
env_specific_config = config_directory.join("#{Rails.env}.config.yml")

0 commit comments

Comments
 (0)