Class: FReCon::Server

Inherits:
Sinatra::Base
  • Object
show all
Includes:
Routes
Defined in:
lib/frecon/server.rb

Class Method Summary collapse

Methods included from Routes

attribute_routes, included, resource_routes

Class Method Details

.run!(**keyword_arguments) ⇒ Object



43
44
45
46
47
# File 'lib/frecon/server.rb', line 43

def self.run!(**keyword_arguments)
  setup!(**keyword_arguments)

  super
end

.setup!(configuration: Configuration.construct!) ⇒ Object



32
33
34
35
36
37
38
39
40
41
# File 'lib/frecon/server.rb', line 32

def self.setup!(configuration: Configuration.construct!)
  set :server, %w[thin HTTP webrick]
  set :bind, configuration["frecon"]["server"]["host"]
  set :port, configuration["frecon"]["server"]["port"]
  set :environment, configuration["frecon"]["server"]["environment"]

  mongoid = configuration["frecon"]["database"]["mongoid"]

  Database.setup(environment: environment, mongoid: mongoid)
end

.start(**keyword_arguments) ⇒ Object



26
27
28
# File 'lib/frecon/server.rb', line 26

def self.start(**keyword_arguments)
  run!(**keyword_arguments)
end