26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
# File 'lib/conjur/webserver/server.rb', line 26
def start(root)
require 'rack'
require 'conjur/webserver/login'
require 'conjur/webserver/authorize'
require 'conjur/webserver/api_proxy'
require 'conjur/webserver/home'
require 'conjur/webserver/conjur_info'
require 'pry'
sessionid = self.sessionid
cookie_options = {
secret: SecureRandom.hex(32),
expire_after: 24*60*60
}
api_stack = [
[Rack::Session::Cookie, cookie_options],
[Conjur::WebServer::ConjurInfo]
]
app = Rack::Builder.app do
map "/login" do
use Rack::Session::Cookie, cookie_options
run Conjur::WebServer::Login.new sessionid
end
map "/api" do
api_stack.each{|args| use *args}
run Conjur::WebServer::APIProxy.new
end
%w(js css fonts images).each do |path|
map "/#{path}" do
run Rack::File.new(File.join(root, path), 'Cache-Control' => 'max-age=0')
end
end
map "/ui" do
run Conjur::WebServer::Home.new(root)
end
end
options = {
app: app,
Port: port,
Threads: '0:64',
Verbose: true
}
Conjur.configuration.env
Rack::Server.start(options)
end
|