Class Picnic::Conf
In: lib/picnic/conf.rb
Parent: Object

Provides an interface for accessing your Picnic app‘s configuration file.

Usage example:

  # Load the configuration from /etc/foo/config.yml
  Conf.load('foo')

  # The contents of config.yml is now available as follows:
  puts Conf[:server]
  puts Conf[:authentication][:username]
  # ... etc.

Methods

Public Class methods

Read a configuration option.

For example:

  puts Conf[:server]

Copies the example config file into the appropriate configuration directory.

app:The name of your application. For example: foo
+dest_conf_file:The path where the example conf file should be copied to. For example: /etc/foo/config.yml

Returns the path to your application‘s example config file.

The example config file should be in the root directory of your application‘s distribution package and should be called config.example.yml. This file is used as a template for your app‘s configuration, to be customized by the end user.

Loads the configuration from the yaml file for the given app.

app should be the name of your app; for example: foo.

By default, the configuration will be loaded from /etc/<app>/config.yml. You can override this by setting a global $CONFIG_FILE variable.

Another way of reading a configuration option.

The following statements are equivalent:

  puts Conf[:server]
  puts Conf.server

[Validate]