You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

30 lines
601 B

module Cdao
module DatabaseConnector
class << self
attr_writer :config, :config_path
def database_config
config["database"]
end
def config
@config ||=
if File.exist?(config_path)
File.open(config_path) do |file|
YAML.safe_load(ERB.new(file.read).result)[::Rails.env]
end
else
{}
end
end
def config_path
@config_path ||= File.join(::Rails.root, "config", "database.cdao.yml")
end
def reset
@config = nil
end
end
end
end