blob: 174d6ac67503a8e0c5f7e5f0566d92249d839834 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
require 'kernel_ext'
require 'json'
require 'nickserver/em_server'
require 'nickserver/couch_db/source'
require 'nickserver/hkp/source'
require 'nickserver/adapters/em_http'
#
# This is the main HTTP server that clients connect to in order to fetch keys
#
# For info on EM::HttpServer, see https://github.com/eventmachine/evma_httpserver
#
module Nickserver
class Server
#
# Starts the Nickserver. Must be run inside an EM.run block.
#
# Available options:
#
# * :port (default Nickserver::Config.port)
# * :host (default 127.0.0.1)
#
def self.start(opts={})
Nickserver::Config.load
options = {
host: '127.0.0.1',
port: Nickserver::Config.port.to_i
}.merge(opts)
unless defined?(TESTING)
puts "Starting nickserver #{options[:host]}:#{options[:port]}"
end
Nickserver::EmServer.start(options)
end
end
end
|