Configatron is a new Ruby library that makes it easy to have persistently accessible configuration data available through your Ruby application. It bears some similarities to the Rails pluginSimpleConfig, but being distributed as a gem, is suitable for non-Rails applications. To install: gem install configatron
Once configatron is installed, the following code will get things going:
configatron do |config| config.app_name = "My Awesomely Jazzy App" config.database_url = "postgres://localhost/somedb" # etc... end
And then you can access these configuration variables throughout your application, like so:
config.app_name # => "My Awesomely Jazzy App" config.database_url # => "postgres://localhost/somedb"
Configatron comes from Mark Bates, creator of the Mack Web application framework.
Post supported by thoughtbot training — thoughtbot is a five year old web development consultancy, specializing exclusively in Ruby since Rails 1.0. We now provide an Advanced Rails training class, sharing our lessons from the trenches and interactively taking participants through the source and development process of a real-world app, Umbrella Today.
by Genís