all repos — litestore @ 928d68e2ae790f3f04bbec673c0c518e554ae0a0

A minimalist nosql document store.

Fixed middleware resolution in child stores.
h3rald h3rald@h3rald.com
Mon, 30 Mar 2020 22:24:54 +0200
commit

928d68e2ae790f3f04bbec673c0c518e554ae0a0

parent

884542316b64c5ac88aaa4b2bb76657dae8d1e46

3 files changed, 5 insertions(+), 3 deletions(-)

jump to
M src/litestorepkg/lib/api_v7.nimsrc/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.nimsrc/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.nimsrc/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 = ""