- move the initialization of config/library/storage to mango.cr

- remove duplicate initialization of server in server.cr
This commit is contained in:
Alex Ling
2020-02-16 04:14:38 +00:00
parent e7583ce788
commit 7c66b05872
3 changed files with 12 additions and 9 deletions

View File

@@ -11,10 +11,7 @@ class Server
property library : Library
property storage : Storage
def initialize
@config = Config.load
@library = Library.new @config.@library_path
@storage = Storage.new @config.db_path
def initialize(@config, @library, @storage)
error 403 do |env|
message = "You are not authorized to visit #{env.request.path}"
@@ -54,7 +51,6 @@ class Server
layout "user"
end
get "/admin/user/edit" do |env|
username = env.params.query["username"]?
admin = env.params.query["admin"]?
@@ -322,6 +318,3 @@ class Server
Kemal.run
end
end
server = Server.new
server.start