summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2012-12-20 11:34:45 +0100
committerAzul <azul@leap.se>2012-12-20 11:34:45 +0100
commit5f05c741f216a61beddaed506670381db5c6425d (patch)
treec1b1d3f299c9022cf36c586816b5896a15709825 /config
parent5d61ba0a80399b9e725881f857fdfa5414e5ef3f (diff)
Loading config defaults from default.yml now
You can overwrite them in config/config.yml
Diffstat (limited to 'config')
-rw-r--r--config/config.yml.example8
-rw-r--r--config/defaults.yml (renamed from config/config.yml)3
-rw-r--r--config/initializers/load_config.rb8
3 files changed, 10 insertions, 9 deletions
diff --git a/config/config.yml.example b/config/config.yml.example
deleted file mode 100644
index c34dd10..0000000
--- a/config/config.yml.example
+++ /dev/null
@@ -1,8 +0,0 @@
-development:
- admins: [admin, admin2]
-
-test:
- admins: [admin, admin2]
-
-production:
- admins: []
diff --git a/config/config.yml b/config/defaults.yml
index c34dd10..4ffa2c9 100644
--- a/config/config.yml
+++ b/config/defaults.yml
@@ -1,8 +1,11 @@
development:
admins: [admin, admin2]
+ domain: develop.me
test:
admins: [admin, admin2]
+ domain: test.me
production:
admins: []
+ domain: deploy.me
diff --git a/config/initializers/load_config.rb b/config/initializers/load_config.rb
index e687429..6cfde12 100644
--- a/config/initializers/load_config.rb
+++ b/config/initializers/load_config.rb
@@ -1 +1,7 @@
-APP_CONFIG = YAML.load_file("#{Rails.root}/config/config.yml")[Rails.env]
+def load_config_file(file)
+ File.exists?(file) ? YAML.load_file(file)[Rails.env] : {}
+end
+
+defaults = load_config_file("#{Rails.root}/config/defaults.yml")
+config = load_config_file("#{Rails.root}/config/config.yml")
+APP_CONFIG = defaults.merge(config)