README.rdoc

configvars_rails

Global configuration variables for a Ruby on Rails 3 application.

Configuration for Rails application is idiomatically stored in the source
code, under the config/ directory. This approach has many upsides, such as
having the configuration go under version control together with the rest of
the code.

However, it also means that the source code has to be modified to make any
configuration change. This makes it unlikely that the same code can be used
in different deployments.

Installation

Scaffold the model, controller, and views.

rails g configvars:all

Note: the code inside the models and controllers is tucked away in the
plug-in. The scaffold model and controller is there as an point. You will
be able to update the plug-in without regenerating the scaffolds.

Edit app/controllers/config_vars_controller.rb to plug in your access
control mechanism.

Usage

It is safe to define configuration variables anywhere in your code - make
sure it gets loaded in development mode, though! The scaffold defines a
couple variables in config/initializers/config_vars.rb

Variables can be redefined. Other plugins can define their own variables,
as long as they include configvars_rails as a gem dependency, to ensure
proper load order.

When the application is running, a rudimentary UI for editing configuration
variables is available at

http://your-app-server/config_vars

By default, the page is protected with HTTP Basic authentication. The
default username:password combo is config:vars. The credentials can be
tweaked by (you guessed!) changing the config_vars.http_user and
config_vars.http_password configuration variables.

You can get HTTP Basic authentication for your other actions by calling
config_vars_auth in your controllers, as if it was before_filter. This is
particularly handy as a quick patch the authorization issues that come up
when open-sourcing an application that's running in production.

config_vars_auth, :except => :index

Note on Patches/Pull Requests

Fork the project.

Make your feature addition or bug fix.

Add tests for it. This is important so I don't break it in a future
version unintentionally.

Commit, do not mess with rakefile, version, or history. (if you want to
have your own version, that is fine but bump version in a commit by itself
I can ignore when I pull)