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".
This commit is contained in:
Joris Vink 2019-09-26 19:58:13 +02:00
parent 1f7405b1d3
commit f725ca228c
3 changed files with 10 additions and 14 deletions

View File

@ -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"

View File

@ -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);
}

View File

@ -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) {