From 4c86d517c990140ddeb27af56dc7f43df2840f69 Mon Sep 17 00:00:00 2001 From: Jared Pace Date: Tue, 3 Aug 2010 22:04:03 -0500 Subject: [PATCH] Add a configuration class --- config/config.yml | 1 + config/initializers/load_config.rb | 8 ++++++++ 2 files changed, 9 insertions(+), 0 deletions(-) create mode 100644 config/config.yml create mode 100644 config/initializers/load_config.rb diff --git a/config/config.yml b/config/config.yml new file mode 100644 index 0000000..c9d6c04 --- /dev/null +++ b/config/config.yml @@ -0,0 +1 @@ +email_at_notices: [1, 10, 100] \ No newline at end of file diff --git a/config/initializers/load_config.rb b/config/initializers/load_config.rb new file mode 100644 index 0000000..b8e8b88 --- /dev/null +++ b/config/initializers/load_config.rb @@ -0,0 +1,8 @@ +require 'ostruct' + +yaml = File.read(Rails.root.join('config','config.yml')) +config = YAML.load(yaml) + +config.merge!(config.delete(Rails.env)) if config.has_key?(Rails.env) + +::App = OpenStruct.new(config) \ No newline at end of file -- libgit2 0.21.2