Class: Jerakia::Server

Inherits:
Object
  • Object
show all
Defined in:
lib/jerakia/server.rb,
lib/jerakia/server/auth.rb,
lib/jerakia/server/rest.rb,
lib/jerakia/server/auth/token.rb

Defined Under Namespace

Classes: Auth, Rest

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.configObject (readonly)

Returns the value of attribute config


16
17
18
# File 'lib/jerakia/server.rb', line 16

def config
  @config
end

Class Method Details

.default_configObject


18
19
20
21
22
23
24
# File 'lib/jerakia/server.rb', line 18

def default_config
  {
  'bind' => '127.0.0.1',
  'port' => '9843',
  'token_ttl' => 300,
  }
end

.jerakiaObject


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

def jerakia
  @jerakia
end

.start(opts, server_opts = {}) ⇒ Object


30
31
32
33
34
35
36
37
38
39
# File 'lib/jerakia/server.rb', line 30

def start(opts, server_opts={})
  @jerakia = Jerakia.new(opts)
  require 'jerakia/server/rest'
  @config = default_config.merge(Jerakia.config[:server] || {}).merge(server_opts)
  Thin::Logging.logger=Jerakia.log.logger
  Jerakia::Server::Rest.set :bind, @config['bind']
  Jerakia::Server::Rest.set :port, @config['port']
  Jerakia.log.verbose("Starting Jerakia on #{@config['bind']}:#{@config['port']}")
  Jerakia::Server::Rest.run!
end

Instance Method Details

#jerakiaObject


7
8
9
# File 'lib/jerakia/server.rb', line 7

def jerakia
  self.class.jerakia
end