9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/highcarb/services.rb', line 9
def start!(command, logger, auth)
EM.run do
if command.options["ws"]
EM::WebSocket.start(host: '0.0.0.0', port: command.options["ws-port"] ) do |websocket|
WSConnection.new websocket, logger
end
end
Thin::Server.start(
'0.0.0.0',
command.options["http-port"],
Rack::Builder.new do
if auth
use Rack::Auth::Basic, "HighCarb" do |username, password|
username == auth[0] && password == auth[1]
end
end
run RackApp.new(command)
end
)
end
end
|