api: Make knownOrigins parsing logic more robust.

This commit is contained in:
Jonathan Bernard 2024-08-12 17:31:29 -05:00
parent f848514df1
commit 7992691d94

View File

@ -30,7 +30,7 @@ proc loadConfig(args: Table[string, docopt.Value]): HffEntryFormsApiConfig =
debug: cfg.hasKey("debug") and cfg.getVal("debug") == "true", debug: cfg.hasKey("debug") and cfg.getVal("debug") == "true",
eventParentId: cfg.getVal("event-parent-id"), eventParentId: cfg.getVal("event-parent-id"),
integrationToken: cfg.getVal("integration-token"), integrationToken: cfg.getVal("integration-token"),
knownOrigins: cfg.getVal("known-origins")[1..^2].split(',').mapIt(it[1..^2]), knownOrigins: cfg.getVal("known-origins")[1..^2].split(',').mapIt(it.strip[1..^2]),
notionApiBaseUrl: cfg.getVal("notion-api-base-url"), notionApiBaseUrl: cfg.getVal("notion-api-base-url"),
notionVersion: cfg.getVal("notion-version"), notionVersion: cfg.getVal("notion-version"),
notionConfigDbId: cfg.getVal("notion-config-db-id"), notionConfigDbId: cfg.getVal("notion-config-db-id"),