Commit 472a65c0 authored by Evandro Jr's avatar Evandro Jr

allows erb templates in_database.yml

parent 1eeb24c6
......@@ -26,7 +26,7 @@ module Noosfero
def self.load_map
db_file = Rails.root.join('config', 'database.yml')
db_config = YAML.load_file(db_file)
db_config = YAML.load(ERB.new(File.read(db_file)).result)
map = { }
db_config.each do |env, attr|
next unless env.match(/_#{Rails.env}$/) and attr['adapter'] =~ /^postgresql$/i
......@@ -37,7 +37,7 @@ module Noosfero
def self.is_hosted_environment?
db_file = Rails.root.join('config', 'database.yml')
db_config = YAML.load_file(db_file)
db_config = YAML.load(ERB.new(File.read(db_file)).result)
db_config.select{ |env, attr| Rails.env.to_s.match(/_#{env}$/) }.any?
end
......
task :load_backup_config do
$config = YAML.load_file('config/database.yml')
db_file = Rails.root.join('config', 'database.yml')
$config = YAML.load(ERB.new(File.read(db_file)).result)
end
task :check_backup_support => :load_backup_config do
......
#!/usr/bin/env ruby
require 'yaml'
config = YAML.load_file(File.dirname(__FILE__) + '/../config/database.yml')['production']
require 'erb'
config = YAML.load(ERB.new(File.read(File.dirname(__FILE__) + '/../config/database.yml')).result)['production']
puts "[PostgreSQLEjabberdNoosfero]"
puts "Description = PostgreSQL Noosfero ejabberd database"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment