-
Notifications
You must be signed in to change notification settings - Fork 2
Getting started
Igor Balos edited this page May 26, 2020
·
7 revisions
Using the configurator library is simple. In order to load yaml configuration files from a folder, all you need to do is the following.
Let's say that you have the following folder and files:
/config/account.production.yaml
/config/account.staging1.yaml
/config/emails.yaml
To load configuration files for production, you would do the following:
require 'configurator'
App.config.files_path = '/config/'
App.config.load_all!
This command will load all YAML files from '/config/' folder which are related to production, in this case those would be:
- /config/account.production.yaml
- /config/emails.yaml
By default, environment is always production. If you setup your configurator like this:
require 'configurator'
App.config.files_path = '/config/'
App.config.environment = 'staging1'
App.config.load_all!
you would be loading staging1 environment files which would be:
- /config/account.staging1.yaml
- /config/emails.yaml
Once files are loaded you can access them as following:
- App.config.account - this will retrieve all account yaml file configuration settings