Class: Backdat::Application::Server

Inherits:
Backdat::Application show all
Defined in:
lib/backdat/application/backdat-server.rb

Overview

The backdat server command line parser.

Instance Method Summary collapse

Methods inherited from Backdat::Application

#configure_backdat, #configure_logging, debug_stacktrace, exit!, fatal!, #reconfigure, #run

Constructor Details

#initializeServer

Grabs all of the cli parameters and generates the mixlib config object.



95
96
97
98
# File 'lib/backdat/application/backdat-server.rb', line 95

def initialize
  super
  Backdat::Config.merge!(config)
end

Instance Method Details

#run_applicationObject

Runs the backdat server.



112
113
114
115
116
117
118
# File 'lib/backdat/application/backdat-server.rb', line 112

def run_application
  if Backdat::Config[:daemonize]
    Backdat::Config[:server] = true
    Backdat::Daemon.daemonize("backdat")
  end
  @app.run
end

#setup_applicationObject

Configures the backdat server based on the cli parameters.



101
102
103
104
105
106
107
108
109
# File 'lib/backdat/application/backdat-server.rb', line 101

def setup_application
  Backdat::Daemon.change_privilege
  Backdat::Config[:server] = true if Backdat::Config[:daemonize]
  if Backdat::Config[:server]
    @app = Backdat::Server.new
  else
    @app = Backdat::Client.new(*ARGV)
  end
end