Where is the best way to download a YAML application configuration file?

I installed my application configuration for my rails 3.1 application, as described here by Ryan Bates.

The problem is that I want to use the configuration in my environment file for the username / password for ActionMailer, but Ryan suggests loading the configuration from the initializer, and they seem to be included after environment.rb. Where is the best place to download a configuration file so that the entire rails application can access it?

thanks

+4
source share
1 answer

In this case, this code should be entered as a preliminary initializer. Starting with Rails 3, all pre-initialization code should be near the top of application.rb, before the line require 'rails/all'

application.rb:

 require File.expand_path('../boot', __FILE__) # load app_config.yml require 'yaml' APP_CONFIG = YAML.load(File.read(File.expand_path('../app_config.yml', __FILE__))) require 'rails/all' 
+6
source

Source: https://habr.com/ru/post/1369504/


All Articles