api: Fix file naming, add support for DEBUG env var.

This commit is contained in:
2024-08-12 14:45:49 -05:00
parent dd384f2b53
commit f9184379b2
4 changed files with 15 additions and 13 deletions

View File

@@ -1,4 +1,5 @@
import cliutils, docopt, json, logging, sequtils, strutils, tables
import std/[json, logging, os, sequtils, strutils, tables]
import cliutils, docopt
import hff_entry_forms_apipkg/api
import hff_entry_forms_apipkg/version
@@ -26,7 +27,7 @@ proc loadConfig(args: Table[string, docopt.Value]): HffEntryFormsApiConfig =
let cfg = CombinedConfig(docopt: args, json: json)
result = HffEntryFormsApiConfig(
debug: args["--debug"],
debug: cfg.hasKey("debug") and cfg.getVal("debug") == "true",
eventParentId: cfg.getVal("event-parent-id"),
integrationToken: cfg.getVal("integration-token"),
knownOrigins: cfg.getVal("known-origins")[1..^2].split(',').mapIt(it[1..^2]),
@@ -59,11 +60,11 @@ Options:
# Initialize our service context
let args = docopt(doc, version = HFF_ENTRY_FORMS_API_VERSION)
if args["--debug"]:
consoleLogger.levelThreshold = lvlDebug
let cfg = loadConfig(args)
if cfg.debug:
consoleLogger.levelThreshold = lvlDebug
if args["serve"]: start(cfg)
except: