lib/rest-ftp-daemon/settings.rb in rest-ftp-daemon-0.221.2 vs lib/rest-ftp-daemon/settings.rb in rest-ftp-daemon-0.222.0
- old
+ new
@@ -5,46 +5,46 @@
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"
+ port = self["port"]
+ self["pidfile"] || "/tmp/#{APP_NAME}.port#{port}.pid"
end
# Direct access to any depth
def at *path
- path.reduce(Settings) {|m,key| m && m[key.to_s] }
+ 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 )
+ to_hash.to_yaml(indent: 4, useheader: true, useversion: false )
end
def init_defaults
- Settings['host'] ||= `hostname`.chomp.split('.').first
+ Settings["host"] ||= `hostname`.chomp.split(".").first
end
def newrelic_enabled?
Settings.at(:debug, :newrelic)
end
def init_newrelic
# Skip if not enabled
- return ENV['NEWRELIC_AGENT_ENABLED'] = 'false' unless Settings.newrelic_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
+ ENV["NEWRELIC_AGENT_ENABLED"] = "true"
+ ENV["NEW_RELIC_MONITOR_MODE"] = "true"
# License
- ENV['NEW_RELIC_LICENSE_KEY'] = Settings.at(:debug, :newrelic)
+ ENV["NEW_RELIC_LICENSE_KEY"] = Settings.at(:debug, :newrelic)
# Appname
- ENV['NEW_RELIC_APP_NAME'] = "#{APP_NICK}-#{Settings.host}-#{APP_ENV}"
+ ENV["NEW_RELIC_APP_NAME"] = "#{APP_NICK}-#{Settings.host}-#{APP_ENV}"
# Logfile
- ENV['NEW_RELIC_LOG'] = Settings.at(:logs, :newrelic)
+ ENV["NEW_RELIC_LOG"] = Settings.at(:logs, :newrelic)
end
end