summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-01-11 19:30:56 +0100
committerStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-01-11 19:30:56 +0100
commitaf49b3390ce352297c3b601c69b6b0557a9ae01d (patch)
tree65d4537721f90327c490b43af845625f16ac987b
parent697477cca48c8402c6d8e1df73d5c8c902c582ee (diff)
Load the production database configuration from the system odbc.ini file.
-rw-r--r--Gemfile1
-rw-r--r--Gemfile.lock2
-rw-r--r--config/database.yml27
3 files changed, 24 insertions, 6 deletions
diff --git a/Gemfile b/Gemfile
index 8609613..d505227 100644
--- a/Gemfile
+++ b/Gemfile
@@ -8,6 +8,7 @@ gem 'cancan'
gem 'state_machine'
gem 'acts_as_list'
gem 'dalli' # memcached
+gem 'inifile'
# Useful Rails 4 stuff
#
diff --git a/Gemfile.lock b/Gemfile.lock
index fc4ba3a..77d09fe 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -93,6 +93,7 @@ GEM
http_accept_language (1.0.2)
http_parser.rb (0.5.3)
i18n (0.6.1)
+ inifile (2.0.2)
journey (1.0.3)
jquery-rails (2.0.1)
railties (>= 3.2.0, < 5.0)
@@ -192,6 +193,7 @@ DEPENDENCIES
haml
hirb
http_accept_language
+ inifile
jquery-rails
json
mini_magick
diff --git a/config/database.yml b/config/database.yml
index bd1748e..706ed06 100644
--- a/config/database.yml
+++ b/config/database.yml
@@ -1,13 +1,26 @@
development:
+ adapter: sqlite3
+ database: db/development.sqlite3
+ pool: 5
+ timeout: 5000
+
+# Read the database configuration from the system odbc
+# configuration.
+#
+<%- system_odbc_ini_file = '/var/lib/.odbc.ini' %>
+<%- if File.exists?(system_odbc_ini_file) %>
+<%- system_odbc_configuration = IniFile.load(system_odbc_ini_file) %>
+<%- if !system_odbc_configuration['gemeinschaft']['DATABASE'].blank? && !system_odbc_configuration['gemeinschaft']['USER'].blank? %>
+production:
adapter: mysql2
encoding: utf8
- database: gemeinschaft
- pool: 5
- username: gemeinschaft
- password: gemeinschaft
+ database: <%= system_odbc_configuration['gemeinschaft']['DATABASE'] %>
+ pool: 10
+ username: <%= system_odbc_configuration['gemeinschaft']['USER'] %>
+ password: <%= system_odbc_configuration['gemeinschaft']['PASSWORD'] %>
socket: /var/run/mysqld/mysqld.sock
- reconnect: true
-
+ reconnect: true
+<%- else %>
production:
adapter: mysql2
encoding: utf8
@@ -17,6 +30,8 @@ production:
password: gemeinschaft
socket: /var/run/mysqld/mysqld.sock
reconnect: true
+<%- end %>
+<%- end %>
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".