Fixed middleware resolution in child stores.
h3rald h3rald@h3rald.com
Mon, 30 Mar 2020 22:24:54 +0200
3 files changed,
5 insertions(+),
3 deletions(-)
M
src/litestorepkg/lib/api_v7.nim
→
src/litestorepkg/lib/api_v7.nim
@@ -1180,7 +1180,7 @@ LOG.warn("Middleware '$1' not found" % id)
else: result = LS.middleware[id] -proc getMiddlewareSeq(resource, id, meth: string): seq[string] = +proc getMiddlewareSeq(LS: LiteStore, resource, id, meth: string): seq[string] = result = newSeq[string]() if LS.config.kind != JObject or not LS.config.hasKey("resources"): return@@ -1206,7 +1206,8 @@ for m in mw:
result.add m.getStr proc execute*(req: var LSRequest, LS: LiteStore, resource, id: string): LSResponse = - let middleware = getMiddlewareSeq(resource, id, $req.reqMethod) + echo LS.file + let middleware = getMiddlewareSeq(LS, resource, id, $req.reqMethod) LOG.debug("Middleware: " & middleware.join(" -> ")); if middleware.len == 0: return route(req, LS, resource, id)
M
src/litestorepkg/lib/core.nim
→
src/litestorepkg/lib/core.nim
@@ -750,6 +750,7 @@ result.appname = LS.appname
result.appversion = LS.appversion result.favicon = LS.favicon result.file = file + result.middleware = newStringTable() if config != newJNull(): result.config = config LOG.info("Initializing store '$1'" % id)
M
src/litestorepkg/lib/types.nim
→
src/litestorepkg/lib/types.nim
@@ -118,7 +118,7 @@
proc initLiteStore*(): LiteStore = result.config = newJNull() result.configFile = "" - result.cliSettings = newJNull() + result.cliSettings = newJObject() result.directory = "" result.manageSystemData = false result.file = ""