lib/fozzie/configuration.rb in fozzie-0.0.2 vs lib/fozzie/configuration.rb in fozzie-0.0.3
- old
+ new
@@ -11,14 +11,14 @@
def initialize(args = {})
merge_and_assign_config(args)
self
end
-
+
def data_prefix
- s = "%s." % env
- s = appname << ".#{s}" unless appname.nil? || appname.empty?
+ s = env
+ s = [appname, s].join('.').strip unless appname.nil? || appname.empty?
s
end
private
@@ -34,14 +34,14 @@
end
# Default configuration settings
# @return [Hash]
def self.default_configuration
- {
- :host => '127.0.0.1',
- :port => 8125,
- :config_path => '',
+ {
+ :host => '127.0.0.1',
+ :port => 8125,
+ :config_path => '',
:env => (ENV['RAILS_ENV'] || 'development'),
:appname => ''
}.dup
end
@@ -50,10 +50,11 @@
end
def config_from_yaml(args)
fp = full_config_path(args[:config_path])
return {} unless File.exists?(fp)
- YAML.load(File.open(fp))[args[:env]].symbolize_keys
+ cnf = YAML.load(File.open(fp))[args[:env]]
+ (cnf.kind_of?(Hash)) ? cnf.symbolize_keys : {}
end
end
end
\ No newline at end of file