CLI fixed.

This commit is contained in:
Luka Vandervelden 2019-10-01 12:15:47 +02:00
parent 3d44756e0e
commit 0862bf4d4c

View File

@ -1,6 +1,6 @@
require "kemal"
require "uuid"
require "file_utils"
require "option_parser"
require "authd"
@ -13,7 +13,7 @@ storage_directory = "./projects"
# Itll get replaced later. But FIXME, this is only a temporary workaround.
authd = nil.unsafe_as AuthD::Client
Kemal.config.extra_options do |parser|
OptionParser.parse do |parser|
parser.on "-k file", "--jwt-key file", "Provides the JWT key for authd." do |file|
authd_key = File.read(file).chomp
end
@ -21,6 +21,11 @@ Kemal.config.extra_options do |parser|
parser.on "-S dir", "--storage dir", "Provides a directory in which to store kanbands data and projects." do |dir|
storage_directory = dir
end
parser.on "-h", "--help", "Prints this help message." do
puts parser
exit 0
end
end
class ConnectionArray < Array(Int32)
@ -55,20 +60,6 @@ end
sockets = ConnectionArray.new
users = ConnectionHash.new
get "/" do
File.read "index.html"
end
get "/style.css" do |env|
env.response.content_type = "text/css"
File.read "style.css"
end
get "/main.js" do |env|
env.response.content_type = "text/javascript"
File.read "main.js"
end
authd = AuthD::Client.new
key = authd_key