kore

Kore is a web application platform for writing scalable, concurrent web based processes in C or Python.
Commits | Files | Refs | README | LICENSE | git clone https://git.kore.io/kore.git

commit f725ca228c97125ad0d1fa20ed67c00d2b306413
parent 1f7405b1d3a5fd88eb23504fd26e55fa4456e504
Author: Joris Vink <joris@coders.se>
Date:   Thu, 26 Sep 2019 19:58:13 +0200

alter python skeleton from kodev create -p.

adds the kore.config.file setting (required a fix for -c) and the
kore.config.deployment option is set to "development".

Diffstat:
src/cli.c | 14+++-----------
src/config.c | 5+++--
src/kore.c | 5++++-
3 files changed, 10 insertions(+), 14 deletions(-)

diff --git a/src/cli.c b/src/cli.c @@ -335,16 +335,7 @@ static const char *python_config_data = "}\n"; static const char *python_init_data = - "import kore\n" - "from .app import koreapp\n" - "\n" - "def kore_parent_configure(args):\n" - " if hasattr(koreapp, \"_appname\"):\n" - " kore.setname(koreapp._appname)\n" - " koreapp.configure(args)\n" - "\n" - "def kore_worker_configure():\n" - " return\n"; + "from .app import koreapp\n"; static const char *python_app_data = "import kore\n" @@ -354,7 +345,8 @@ static const char *python_app_data = " pass\n" "\n" " def configure(self, args):\n" - " pass\n" + " kore.config.file = \"kore.conf\"\n" + " kore.config.deployment = \"development\"\n" "\n" " async def index(self, req):\n" " req.response(200, b'')\n" diff --git a/src/config.c b/src/config.c @@ -552,8 +552,9 @@ config_file_write(void) static int configure_file(char *file) { - kore_free(config_file); - config_file = kore_strdup(file); + free(config_file); + if ((config_file = strdup(file)) == NULL) + fatal("strdup"); return (KORE_RESULT_OK); } diff --git a/src/kore.c b/src/kore.c @@ -182,7 +182,9 @@ main(int argc, char *argv[]) switch (ch) { #if !defined(KORE_SINGLE_BINARY) case 'c': - config_file = optarg; + free(config_file); + if ((config_file = strdup(optarg)) == NULL) + fatal("strdup"); break; #endif #if defined(KORE_DEBUG) @@ -284,6 +286,7 @@ main(int argc, char *argv[]) #endif kore_parse_config(); + free(config_file); #if !defined(KORE_NO_HTTP) if (http_body_disk_offload > 0) {