kore

An easy to use, scalable and secure web application framework for writing web APIs in C.
Commits | Files | Refs | README | LICENSE | git clone https://git.kore.io/kore.git

commit ff21fd330fde6495dad35859ba1ef3f9afc94fdd
parent 823e76f582527a6c3dd76dd7109c2b75544081af
Author: Joris Vink <joris@coders.se>
Date:   Thu,  1 Mar 2018 12:55:33 +0100

Add python_path configuration option.

Allows adding more items to the python path so imports from inside
python scripts work more sensible depending on how you configure your
app.

Diffstat:
src/config.c | 10++++++++++
src/python.c | 6++++++
2 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/src/config.c b/src/config.c @@ -107,6 +107,7 @@ static int configure_task_threads(char *); #endif #if defined(KORE_USE_PYTHON) +static int configure_python_path(char *); static int configure_python_import(char *); #endif @@ -121,6 +122,7 @@ static struct { { "bind", configure_bind }, { "load", configure_load }, #if defined(KORE_USE_PYTHON) + { "python_path", configure_python_path }, { "python_import", configure_python_import }, #endif { "domain", configure_domain }, @@ -1138,6 +1140,14 @@ configure_task_threads(char *option) #if defined(KORE_USE_PYTHON) 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]; diff --git a/src/python.c b/src/python.c @@ -147,6 +147,12 @@ kore_python_cleanup(void) } } +void +kore_python_path(const char *path) +{ + python_append_path(path); +} + static void * python_malloc(void *ctx, size_t len) {