Commit 472a65c0e5f123c29c8e84b1ae33d29bcee3ed3f
1 parent
1eeb24c6
Exists in
staging
and in
38 other branches
allows erb templates in_database.yml
Showing
3 changed files
with
6 additions
and
4 deletions
Show diff stats
lib/noosfero/multi_tenancy.rb
| ... | ... | @@ -26,7 +26,7 @@ module Noosfero |
| 26 | 26 | |
| 27 | 27 | def self.load_map |
| 28 | 28 | db_file = Rails.root.join('config', 'database.yml') |
| 29 | - db_config = YAML.load_file(db_file) | |
| 29 | + db_config = YAML.load(ERB.new(File.read(db_file)).result) | |
| 30 | 30 | map = { } |
| 31 | 31 | db_config.each do |env, attr| |
| 32 | 32 | next unless env.match(/_#{Rails.env}$/) and attr['adapter'] =~ /^postgresql$/i |
| ... | ... | @@ -37,7 +37,7 @@ module Noosfero |
| 37 | 37 | |
| 38 | 38 | def self.is_hosted_environment? |
| 39 | 39 | db_file = Rails.root.join('config', 'database.yml') |
| 40 | - db_config = YAML.load_file(db_file) | |
| 40 | + db_config = YAML.load(ERB.new(File.read(db_file)).result) | |
| 41 | 41 | db_config.select{ |env, attr| Rails.env.to_s.match(/_#{env}$/) }.any? |
| 42 | 42 | end |
| 43 | 43 | ... | ... |
lib/tasks/backup.rake
script/odbcconf
| 1 | 1 | #!/usr/bin/env ruby |
| 2 | 2 | |
| 3 | 3 | require 'yaml' |
| 4 | -config = YAML.load_file(File.dirname(__FILE__) + '/../config/database.yml')['production'] | |
| 4 | +require 'erb' | |
| 5 | 5 | |
| 6 | +config = YAML.load(ERB.new(File.read(File.dirname(__FILE__) + '/../config/database.yml')).result)['production'] | |
| 6 | 7 | |
| 7 | 8 | puts "[PostgreSQLEjabberdNoosfero]" |
| 8 | 9 | puts "Description = PostgreSQL Noosfero ejabberd database" | ... | ... |