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