diff options
author | Igor Sysoev <igor@sysoev.ru> | 2017-08-26 13:37:44 +0300 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2017-08-26 13:37:44 +0300 |
commit | 7f5b57bfb9a61ce0ba3fbc74f1775ace2d8ec6ec (patch) | |
tree | 37f69782ab933eb36d305d8d3e6e90c42417a711 /src | |
parent | 9aaa7d8c20e58ed380225cbbbd05248539d2f500 (diff) | |
download | unit-7f5b57bfb9a61ce0ba3fbc74f1775ace2d8ec6ec.tar.gz unit-7f5b57bfb9a61ce0ba3fbc74f1775ace2d8ec6ec.tar.bz2 |
Added configure and command line option --modules.
Diffstat (limited to '')
-rw-r--r-- | src/nxt_application.c | 5 | ||||
-rw-r--r-- | src/nxt_runtime.c | 24 | ||||
-rw-r--r-- | src/nxt_runtime.h | 1 |
3 files changed, 28 insertions, 2 deletions
diff --git a/src/nxt_application.c b/src/nxt_application.c index 4689f622..23182401 100644 --- a/src/nxt_application.c +++ b/src/nxt_application.c @@ -46,9 +46,10 @@ nxt_discovery_start(nxt_task_t *task, void *data) nxt_debug(task, "DISCOVERY"); - b = nxt_discovery_modules(task, "build/nginext.*"); - rt = task->thread->runtime; + + b = nxt_discovery_modules(task, rt->modules); + main_port = rt->port_by_type[NXT_PROCESS_MASTER]; nxt_port_socket_write(task, main_port, NXT_PORT_MSG_MODULES, -1, diff --git a/src/nxt_runtime.c b/src/nxt_runtime.c index d6518fbe..f070bd94 100644 --- a/src/nxt_runtime.c +++ b/src/nxt_runtime.c @@ -703,6 +703,7 @@ nxt_runtime_conf_init(nxt_task_t *task, nxt_runtime_t *rt) rt->group = NXT_GROUP; rt->pid = NXT_PID; rt->log = NXT_LOG; + rt->modules = NXT_MODULES; if (nxt_runtime_conf_read_cmd(task, rt) != NXT_OK) { return NXT_ERROR; @@ -740,6 +741,14 @@ nxt_runtime_conf_init(nxt_task_t *task, nxt_runtime_t *rt) file = nxt_list_first(rt->log_files); file->name = file_name.start; + ret = nxt_file_name_create(rt->mem_pool, &file_name, "%snginext.*%Z", + rt->modules); + if (nxt_slow_path(ret != NXT_OK)) { + return NXT_ERROR; + } + + rt->modules = (char *) file_name.start; + return NXT_OK; } @@ -761,6 +770,8 @@ nxt_runtime_conf_read_cmd(nxt_task_t *task, nxt_runtime_t *rt) static const char no_group[] = "option \"--group\" requires group name\n"; static const char no_pid[] = "option \"--pid\" requires filename\n"; static const char no_log[] = "option \"--log\" requires filename\n"; + static const char no_modules[] = + "option \"--modules\" requires directory\n"; argv = &nxt_process_argv[1]; @@ -857,6 +868,19 @@ nxt_runtime_conf_read_cmd(nxt_task_t *task, nxt_runtime_t *rt) continue; } + if (nxt_strcmp(p, "--modules") == 0) { + if (*argv == NULL) { + write(STDERR_FILENO, no_modules, sizeof(no_modules) - 1); + return NXT_ERROR; + } + + p = *argv++; + + rt->modules = p; + + continue; + } + if (nxt_strcmp(p, "--no-daemon") == 0) { rt->daemon = 0; continue; diff --git a/src/nxt_runtime.h b/src/nxt_runtime.h index 8741f08c..d774aad3 100644 --- a/src/nxt_runtime.h +++ b/src/nxt_runtime.h @@ -57,6 +57,7 @@ struct nxt_runtime_s { const char *group; const char *pid; const char *log; + const char *modules; nxt_queue_t engines; /* of nxt_event_engine_t */ |