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 b17eefde1f2e400a93e1e7a2934d74bb85f46701
parent 105fb272a049210ed3010b303054697ef9f700c2
Author: Joris Vink <joris@coders.se>
Date:   Thu, 31 Jul 2014 17:15:51 +0200

Allow developers to pass the lib to load on the cli.

When running in -f (foreground) you can now specify
the library Kore needs to load on the command line:

kore -fnc module.conf myapp.so

This has the benefit that your configuration file no
longer needs the load directive when hacking on your code.

Note that you can still specify load in your config file
regardless, if you so chose.

All of this is being done in order to try and move away
from the backwards way of getting up and running with Kore.

Diffstat:
src/kore.c | 20++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/src/kore.c b/src/kore.c @@ -49,7 +49,7 @@ static void kore_server_sslstart(void); static void usage(void) { - fprintf(stderr, "Usage: kore [-c config] [-dfnv]\n"); + fprintf(stderr, "Usage: kore [-c config] [-dfnv] [lib [onload]]\n"); exit(1); } @@ -105,7 +105,6 @@ main(int argc, char *argv[]) argv += optind; kore_pid = getpid(); - nlisteners = 0; LIST_INIT(&listeners); @@ -116,8 +115,20 @@ main(int argc, char *argv[]) kore_module_init(); kore_validator_init(); kore_server_sslstart(); - kore_parse_config(); + if (foreground && (argc == 1 || argc == 2)) { + if (argc == 1) + kore_module_load(argv[0], NULL); + else + kore_module_load(argv[0], argv[1]); + } else if (argc > 0) { + fatal("library can only be given when running with -f"); + } + + if (config_file == NULL) + usage(); + + kore_parse_config(); kore_platform_init(); kore_accesslog_init(); @@ -335,7 +346,8 @@ kore_write_kore_pid(void) FILE *fp; if ((fp = fopen(kore_pidfile, "w+")) == NULL) { - kore_debug("kore_write_kore_pid(): fopen() %s", errno_s); + printf("warning: couldn't write pid to %s (%s)\n", + kore_pidfile, errno_s); } else { fprintf(fp, "%d\n", kore_pid); fclose(fp);