Skip to content
This repository has been archived by the owner on Aug 29, 2018. It is now read-only.

medivo/app_config

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

app_config

AppConfig is a gem that allows you to create an config/app_config.yml file in a Rails project and access the keys and values as a hash throughout the project.

This gem is excellent for storing Rails-wide constants.

The App constants should be stored in one or both of the following files (exact filenames are required): config/app_config_default.yml config/app_config.yml

The AppConfig app should be loaded in the initializers directory. Here is an example file:

#config/initializers/app_config.rb
require "app_config"

AppConfig.reload(Rails.env, Rails.root)

Here is an example of what the config/app_config.yml can look like:

defaults: &default
  gmail:
    email: "[email protected]"
    password: "something"

There are two methods to access the email:

#Normal method
AppConfig['gmail']['email']
#Shortcut method
GmailConfig['email']

The shorcut method only works one level deep.

Releases

No releases published

Packages

No packages published

Languages