CLI fixed.
This commit is contained in:
parent
3d44756e0e
commit
0862bf4d4c
23
src/main.cr
23
src/main.cr
@ -1,6 +1,6 @@
|
|||||||
require "kemal"
|
|
||||||
require "uuid"
|
require "uuid"
|
||||||
require "file_utils"
|
require "file_utils"
|
||||||
|
require "option_parser"
|
||||||
|
|
||||||
require "authd"
|
require "authd"
|
||||||
|
|
||||||
@ -13,7 +13,7 @@ storage_directory = "./projects"
|
|||||||
# It’ll get replaced later. But FIXME, this is only a temporary workaround.
|
# It’ll get replaced later. But FIXME, this is only a temporary workaround.
|
||||||
authd = nil.unsafe_as AuthD::Client
|
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|
|
parser.on "-k file", "--jwt-key file", "Provides the JWT key for authd." do |file|
|
||||||
authd_key = File.read(file).chomp
|
authd_key = File.read(file).chomp
|
||||||
end
|
end
|
||||||
@ -21,6 +21,11 @@ Kemal.config.extra_options do |parser|
|
|||||||
parser.on "-S dir", "--storage dir", "Provides a directory in which to store kanband’s data and projects." do |dir|
|
parser.on "-S dir", "--storage dir", "Provides a directory in which to store kanband’s data and projects." do |dir|
|
||||||
storage_directory = dir
|
storage_directory = dir
|
||||||
end
|
end
|
||||||
|
|
||||||
|
parser.on "-h", "--help", "Prints this help message." do
|
||||||
|
puts parser
|
||||||
|
exit 0
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class ConnectionArray < Array(Int32)
|
class ConnectionArray < Array(Int32)
|
||||||
@ -55,20 +60,6 @@ end
|
|||||||
sockets = ConnectionArray.new
|
sockets = ConnectionArray.new
|
||||||
users = ConnectionHash.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
|
authd = AuthD::Client.new
|
||||||
|
|
||||||
key = authd_key
|
key = authd_key
|
||||||
|
Loading…
Reference in New Issue
Block a user