ported plugin loading to the new api

This commit is contained in:
roberto@oneiric64
2012-01-28 07:40:20 +01:00
parent 7523eb1cb0
commit 77a4e3771b
2 changed files with 21 additions and 2 deletions
+20 -2
View File
@@ -339,9 +339,9 @@ static struct uwsgi_option uwsgi_base_options[] = {
{"worker-exec", required_argument, 0, "run the specified command as worker", uwsgi_opt_set_str, &uwsgi.worker_exec, 0},
/*
{"attach-daemon", required_argument, 0, LONG_ARGS_ATTACH_DAEMON,0},
{"plugins", required_argument, 0, LONG_ARGS_PLUGINS,0},
{"autoload", no_argument, &uwsgi.autoload, 1,0},
*/
{"plugins", required_argument, 0, "load uWSGI plugins", uwsgi_opt_load_plugin, NULL, UWSGI_OPT_IMMEDIATE},
{"autoload", no_argument, 0, "try to automatically load plugins when unknown options are found", uwsgi_opt_true, &uwsgi.autoload, 0},
{"allowed-modifiers", required_argument, 0,"comma separated list of allowed modifiers", uwsgi_opt_set_str, &uwsgi.allowed_modifiers, 0},
{"remap-modifier", required_argument, 0, "remap request modifier from one id to another", uwsgi_opt_set_str, &uwsgi.remap_modifier, 0},
{"dump-options", no_argument, 0, "dump the full list of available options", uwsgi_opt_true, &uwsgi.dump_options,0},
@@ -3037,6 +3037,8 @@ void build_options() {
}
}
if (uwsgi.options) free(uwsgi.options);
uwsgi.options = uwsgi_calloc(sizeof(struct uwsgi_option) * options_count+1);
op = uwsgi_base_options;
@@ -3064,8 +3066,12 @@ void build_options() {
pos = 0;
if (uwsgi.long_options) free(uwsgi.long_options);
uwsgi.long_options = uwsgi_calloc(sizeof(struct option) * options_count+1);
if (uwsgi.short_options) free(uwsgi.short_options);
uwsgi.short_options = uwsgi_calloc( (options_count * 2) + 1) ;
op = uwsgi.options;
@@ -3411,6 +3417,18 @@ void uwsgi_opt_daemonize(char *opt, char *logfile, int id, void *none) {
}
}
void uwsgi_opt_load_plugin(char *opt, char *value, int id, void *none) {
char *p = strtok(uwsgi_concat2(value, ""), ",");
while (p != NULL) {
#ifdef UWSGI_DEBUG
uwsgi_debug("loading plugin %s\n", p);
#endif
uwsgi_load_plugin(-1, p, NULL, 0);
p = strtok(NULL, ",");
}
build_options();
}
#ifdef UWSGI_INI
void uwsgi_opt_load_ini(char *opt, char *filename, int id, void *none) {
config_magic_table_fill(filename, uwsgi.magic_table);
+1
View File
@@ -2491,6 +2491,7 @@ void uwsgi_opt_set_dyn(char *, char *, int, void *);
void uwsgi_opt_add_shared_socket(char *, char *, int, void *);
void uwsgi_opt_add_socket(char *, char *, int, void *);
void uwsgi_opt_daemonize(char *, char *, int, void *);
void uwsgi_opt_load_plugin(char *, char *, int, void *);
#ifdef UWSGI_INI
void uwsgi_opt_load_ini(char *, char *, int, void *);
#endif