lib/rest-ftp-daemon/api/root.rb in rest-ftp-daemon-0.242.1 vs lib/rest-ftp-daemon/api/root.rb in rest-ftp-daemon-0.242.2

- old
+ new

@@ -3,15 +3,13 @@ module RestFtpDaemon module API class Root < Grape::API + ### CLASS CONFIG -####### CLASS CONFIG - helpers RestFtpDaemon::LoggerHelper - logger RestFtpDaemon::LoggerPool.instance.get :api do_not_route_head! do_not_route_options! @@ -19,11 +17,11 @@ mount RestFtpDaemon::API::Jobs => "/jobs" mount RestFtpDaemon::API::Dashbaord => "/" -####### INITIALIZATION + ### INITIALIZATION def initialize # Call daddy super @@ -31,35 +29,36 @@ raise RestFtpDaemon::MissingQueue unless defined? $queue raise RestFtpDaemon::MissingPool unless defined? $pool end -####### HELPERS + ### HELPERS helpers do def logger Root.logger end end -####### Common request logging - before do - log_info "HTTP #{request.request_method} #{request.fullpath}", params - end + ### Common request logging + before do + log_info "HTTP #{request.request_method} #{request.fullpath}", params + end -####### SHOW ROUTES + ### SHOW ROUTES + desc "Show application routes" get "/routes" do status 200 return RestFtpDaemon::API::Root.routes end -####### SHOW STATUS + ### SHOW STATUS desc "Show daemon status" get "/status" do mem = GetProcessMem.new status 200 @@ -72,24 +71,24 @@ memory_bytes: mem.bytes.to_i, memory_mb: mem.mb.round(0), status: $queue.counts_by_status, workers: $pool.worker_variables, jobs_count: $queue.jobs_count, - jobs_queued: $queue.queued_ids + jobs_queued: $queue.queued_ids, } end -####### SHOW CONFIG + ### SHOW CONFIG desc "Show daemon config" get "/config" do status 200 return Helpers.get_censored_config end -####### RELOAD CONFIG + ### RELOAD CONFIG desc "Reload daemon config" post "/config/reload" do if Settings.at(:debug, :allow_reload)==true Settings.reload!