markbates / configatron

A super cool, simple, and feature rich configuration system for Ruby apps.

Home Page:http://www.metabates.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Multiple environment configuration files

alolis opened this issue · comments

Hello,

Is there an example or a proposed way to have different files based on ENV for a ruby project?

In other words, if i have a <root>/config/development.rb and a <root>/config/production.rb, is it possible configatron to load the appropriate one based on ENV?

Thank you for any replies,

Alex

If you are using Rails, then Configatron::Rails.init will do that for you.

I am not using Rails. Is there a similar way to do it for pure ruby or do I have to implement the file loading myself?

You would have to do it yourself. You can use the code for Rails as a guide. Essentially though it's pretty simple. Just find the file on disk that matches your environment and load it.

Cheers Mark