lib/conjur/webserver/server.rb in conjur-asset-ui-1.4.2 vs lib/conjur/webserver/server.rb in conjur-asset-ui-1.6.0
- old
+ new
@@ -56,11 +56,11 @@
end
map "/api" do
api_stack.each{|args| use *args}
run Conjur::WebServer::APIProxy.new
end
- %w(build js css fonts images).each do |path|
+ %w(js css fonts images maps).each do |path|
map "/#{path}" do
run Rack::File.new(File.join(root, path), 'Cache-Control' => 'max-age=0')
end
end
map "/ui" do
@@ -82,15 +82,27 @@
Conjur.configuration.env
Rack::Server.start(options)
end
- def open
+ def open headless
require 'launchy'
url = "http://localhost:#{port}/login?sessionid=#{sessionid}"
# as launchy sometimes silently fails, we need human-friendly failover
- $stderr.puts "If your browser did not opened the UI automatically, point it to #{url}"
- Launchy.open(url) unless ENV['DONT_OPEN_IN_BROWSER']
+ if ENV['DONT_OPEN_IN_BROWSER'] or headless
+ puts "Running in headless mode."
+ puts "To reach this UI server via SSH tunnel, run the following command:"
+ puts "ssh -N -L #{port}:localhost:#{port} user@hostname"
+ puts "Then open your browser to the following URL:"
+ puts url
+ else
+ $stderr.puts "If your browser did not opened the UI automatically, point it to #{url}"
+ Launchy.open(url)
+ end
+ end
+
+ def set_port p
+ @port = p
end
protected
def port