lib/rest-ftp-daemon/helpers.rb in rest-ftp-daemon-0.250.5 vs lib/rest-ftp-daemon/helpers.rb in rest-ftp-daemon-0.300.1
- old
+ new
@@ -1,12 +1,12 @@
module RestFtpDaemon
class Helpers
def self.get_censored_config
- config = Settings.to_hash
- config[:users] = Settings.users.keys if Settings.users
- config[:endpoints] = Settings.endpoints.keys if Settings.endpoints
+ config = Conf.to_hash
+ config[:users] = Conf[:users].keys if Conf[:users]
+ config[:endpoints] = Conf[:endpoints].keys if Conf[:endpoints]
config
end
def self.format_bytes number, unit="", decimals = 0
return "Ø" if number.nil? || number.to_f.zero?
@@ -56,24 +56,9 @@
def self.extract_parent path
return unless path.is_a? String
m = path.match(/^(.*)\/([^\/]+)\/?$/)
return m[1], m[2] unless m.nil?
- end
-
- def self.local_port_used? port
- Timeout.timeout(BIND_PORT_TIMEOUT) do
- begin
- TCPSocket.new(BIND_PORT_LOCALHOST, port).close
- true
- rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH
- false
- rescue Errno::EADDRNOTAVAIL
- "Settings.local_port_used: Errno::EADDRNOTAVAIL"
- end
- end
- rescue Timeout::Error
- false
end
def self.job_method_label method
return if method.nil?
klass = case method