lib/conjur/command/ui.rb in conjur-asset-ui-1.4.2 vs lib/conjur/command/ui.rb in conjur-asset-ui-1.6.0
- old
+ new
@@ -20,12 +20,19 @@
#
class Conjur::Command::UI < Conjur::Command
desc "Launch a UI"
arg_name "root-path"
Conjur::CLI.command :ui do |c|
+ c.desc "Port to run the webserver on."
+ c.flag ["p", "port"]
+
+ c.desc "Run on headless server (don't launch the browser)."
+ c.switch [:headless]
+
c.action do |global_options,options,args|
- root = args.pop || File.expand_path('../../../public', File.dirname(__FILE__))
+ root = args.pop || File.expand_path('../../../app/build', File.dirname(__FILE__))
+ port = options[:port]
#TODO: login page
api # just initialize API so if user is not logged in it will be asked for credentials *before* server is launched
@@api=nil # reset to avoid conflicts on server launch
@@ -33,14 +40,15 @@
# after removal of sticky configurations support
ENV["RACK_ENV"]="production"
require 'conjur/webserver/server'
server = Conjur::WebServer::Server.new
+ server.set_port port if port
thread = Thread.new do
server.start(root)
end
sleep 0.5
- server.open
+ server.open options[:headless]
thread.join
end
end
end