From 469fd697cb6a3ce0dfee9b4ba9f1831ac42bfa87 Mon Sep 17 00:00:00 2001 From: Unbit Date: Tue, 17 Sep 2013 14:16:41 +0200 Subject: [PATCH] fixed #383 --- core/emperor.c | 15 +++++++++++++++ core/uwsgi.c | 3 ++- uwsgi.h | 1 + 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/core/emperor.c b/core/emperor.c index 46e45806..004da0dc 100644 --- a/core/emperor.c +++ b/core/emperor.c @@ -1031,6 +1031,12 @@ static void uwsgi_emperor_spawn_vassal(struct uwsgi_instance *n_ui) { uct = uct->next; } + uct = uwsgi.vassals_includes; + while (uct) { + counter += 2; + uct = uct->next; + } + char **vassal_argv = uwsgi_malloc(sizeof(char *) * counter); // set args vassal_argv[0] = uwsgi.binary_path; @@ -1093,6 +1099,15 @@ static void uwsgi_emperor_spawn_vassal(struct uwsgi_instance *n_ui) { counter += 2; uct = uct->next; } + + uct = uwsgi.vassals_includes; + while (uct) { + vassal_argv[counter] = "--include"; + vassal_argv[counter + 1] = uct->value; + counter += 2; + uct = uct->next; + } + vassal_argv[counter] = NULL; // disable stdin OR map it to the "on demand" socket diff --git a/core/uwsgi.c b/core/uwsgi.c index dd9b3170..5b3558b8 100644 --- a/core/uwsgi.c +++ b/core/uwsgi.c @@ -199,7 +199,8 @@ static struct uwsgi_option uwsgi_base_options[] = { #endif {"imperial-monitor-list", no_argument, 0, "list enabled imperial monitors", uwsgi_opt_true, &uwsgi.imperial_monitor_list, 0}, {"imperial-monitors-list", no_argument, 0, "list enabled imperial monitors", uwsgi_opt_true, &uwsgi.imperial_monitor_list, 0}, - {"vassals-inherit", required_argument, 0, "add config templates to vassals config", uwsgi_opt_add_string_list, &uwsgi.vassals_templates, 0}, + {"vassals-inherit", required_argument, 0, "add config templates to vassals config (uses --inherit)", uwsgi_opt_add_string_list, &uwsgi.vassals_templates, 0}, + {"vassals-include", required_argument, 0, "inclue config templates to vassals config (uses --include instead of --inherit)", uwsgi_opt_add_string_list, &uwsgi.vassals_includes, 0}, {"vassals-start-hook", required_argument, 0, "run the specified command before each vassal starts", uwsgi_opt_set_str, &uwsgi.vassals_start_hook, 0}, {"vassals-stop-hook", required_argument, 0, "run the specified command after vassal's death", uwsgi_opt_set_str, &uwsgi.vassals_stop_hook, 0}, {"vassal-sos-backlog", required_argument, 0, "ask emperor for sos if backlog queue has more items than the value specified", uwsgi_opt_set_int, &uwsgi.vassal_sos_backlog, 0}, diff --git a/uwsgi.h b/uwsgi.h index 45140d71..7a50f4cb 100644 --- a/uwsgi.h +++ b/uwsgi.h @@ -1774,6 +1774,7 @@ struct uwsgi_server { char *emperor_stats; int emperor_stats_fd; struct uwsgi_string_list *vassals_templates; + struct uwsgi_string_list *vassals_includes; // true if loyal to the emperor int loyal;