Configuration in Rails app

Let’s not re-write a good article, go to: https://joyofrails.com/articles/mastering-custom-configuration-in-rails

I mostly used config.x configuration that loads a yaml file with config_for that do the multi-environment by default:

module YourApp
  class Application < Rails::Application
    config.x.external_service_xyz = config_for(:xyz_config) # loading the `xyz_config.yml` file
  end
end

This technique is also explained in the above article, check it out.

0
Subscribe to my newsletter

Read articles from Thomas Brennetot directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Thomas Brennetot
Thomas Brennetot

10+ years most with Ruby on Rails and JavaScript frontend and some Go. My first language is C for 3 years in university.