Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
site_config is a fire-and-forget environment-specific site configuration plugin for Rails apps
Ruby
branch: master

This branch is 1 commit ahead of cheald:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
LICENSE
README
init.rb
install.rb
site_config.yml.tpl

README

Site configuration made easy!

Install the plugin:

  script/plugin install git://github.com/cheald/site_config.git
  
Edit your config/site_config.yml with your desired preferences. One key is special: "inherit". This will cause 
a given environment to inherit settings from another environment, unless overridden.

Presume you have the following site_config.yml

  base:
    foo: bar
  
  development:
    inherit: base
    barry: white
  
  production:
    inherit: development
    foo: baz
	
You can then call the following in your code:

  config_option(:foo)
  
If you're in development, you get "bar" (inherited from base). If you're in production, you get "baz" (local to the production configuration).

If you want to get a config option for an environment other than the one you're running in, config_option takes an optional second parameter.

  config_option(:foo, :development)  	=> "bar"		# Inherited from base
  config_option(:barry, :development)	=> "white"		# Local
  config_option(:foo, :production)		=> "baz"		# Local
  config_option(:barry, :production)	=> "white"		# Inherited from development
  
You'll need to restart your app after each change; the config file is only read once in order to maximize performance.

Enjoy!
Something went wrong with that request. Please try again.