Sha256: c64f39927e86d63202afdc3b72be9da11e0fecd2f8aaa2ba6c9338c8f4f98a45
Contents?: true
Size: 1.32 KB
Versions: 3
Compression:
Stored size: 1.32 KB
Contents
# Configuration class class Settings < Settingslogic # Read configuration namespace (defined?(APP_ENV) ? APP_ENV : "production") source ((File.exists? APP_CONF) ? APP_CONF : Hash.new) suppress_errors true # Compute my PID filename def pidfile self["pidfile"] || "/tmp/#{APP_NAME}.port#{self['port'].to_s}.pid" end # Direct access to any depth def at *path path.reduce(Settings) {|m,key| m && m[key.to_s] } end # Dump whole settings set to readable YAML def dump self.to_hash.to_yaml( :Indent => 4, :UseHeader => true, :UseVersion => false ) end def init_defaults Settings['host'] ||= `hostname`.chomp.split('.').first end def newrelic_enabled? Settings.newrelic.is_a?(Hash) && Settings.at(:newrelic, :license) end def init_newrelic # Skip if not enabled return ENV['NEWRELIC_AGENT_ENABLED'] = 'false' unless Settings.newrelic_enabled? # Enable module ENV['NEWRELIC_AGENT_ENABLED'] = 'true' ENV['NEW_RELIC_MONITOR_MODE'] = 'true' #Settings['newrelic']['enabled'] = true # License ENV['NEW_RELIC_LICENSE_KEY'] = Settings.at(:newrelic, :license) # Appname ENV['NEW_RELIC_APP_NAME'] = Settings.at(:newrelic, :appname) || "#{APP_NICK}-#{Settings.host}-#{APP_ENV}" # Logfile ENV['NEW_RELIC_LOG'] = Settings.at(:logs, :newrelic) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rest-ftp-daemon-0.214.0 | lib/rest-ftp-daemon/settings.rb |
rest-ftp-daemon-0.213.0 | lib/rest-ftp-daemon/settings.rb |
rest-ftp-daemon-0.212.0 | lib/rest-ftp-daemon/settings.rb |