From 98d5909b7d57aa68e8514d2fdc2c67d120fc3261 Mon Sep 17 00:00:00 2001 From: Joris Vink Date: Wed, 20 Oct 2021 11:20:25 +0200 Subject: [PATCH] bring back python_import and python_path. These were mistakingly removed a while ago. --- src/config.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/config.c b/src/config.c index 2cd66ac..af23f60 100644 --- a/src/config.c +++ b/src/config.c @@ -156,6 +156,8 @@ static int configure_task_threads(char *); #if defined(KORE_USE_PYTHON) static int configure_deployment(char *); +static int configure_python_path(char *); +static int configure_python_import(char *); #endif #if defined(KORE_USE_CURL) @@ -190,6 +192,10 @@ static struct { { "runas", configure_privsep_runas }, { "client_verify", configure_client_verify }, { "client_verify_depth", configure_client_verify_depth }, +#if defined(KORE_USE_PYTHON) + { "python_path", configure_python_path }, + { "python_import", configure_python_import }, +#endif #if !defined(KORE_NO_HTTP) { "route", configure_route }, { "handler", configure_route_handler }, @@ -2011,6 +2017,26 @@ configure_deployment(char *value) return (KORE_RESULT_OK); } +static int +configure_python_path(char *path) +{ + kore_python_path(path); + + return (KORE_RESULT_OK); +} + +static int +configure_python_import(char *module) +{ + char *argv[3]; + + kore_split_string(module, " ", argv, 3); + if (argv[0] == NULL) + return (KORE_RESULT_ERROR); + + kore_module_load(argv[0], argv[1], KORE_MODULE_PYTHON); + return (KORE_RESULT_OK); +} #endif #if defined(KORE_USE_PLATFORM_PLEDGE)