diff options
author | Igor Sysoev <igor@sysoev.ru> | 2017-08-17 21:47:19 +0300 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2017-08-17 21:47:19 +0300 |
commit | 949548da293fa30ef200d07c3e4ff108174404b7 (patch) | |
tree | 8f03eaad277ec558f9ce2f223db350d134532e4b /src/nxt_conf_validation.c | |
parent | 5ef8e0ee8933e914b1847168255b53f07c3727b3 (diff) | |
download | unit-949548da293fa30ef200d07c3e4ff108174404b7.tar.gz unit-949548da293fa30ef200d07c3e4ff108174404b7.tar.bz2 |
The new module configuration interface.
Configuration and building example:
./configure
./configure python
./configure php
./configure go
make all
or
./configure
make nginext
./configure python
make python
./configure php
make php
./configure go
make go
Modules configuration options and building examples:
./configure python --module=python2 --config=python2.7-config
make python2
./configure php --module=php7 --config=php7.0-config
--lib-path=/usr/local/php7.0
make php7
./configure go --go=go1.6 --go-path=${HOME}/go1.6
make go1.6
Diffstat (limited to 'src/nxt_conf_validation.c')
-rw-r--r-- | src/nxt_conf_validation.c | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/src/nxt_conf_validation.c b/src/nxt_conf_validation.c index 0608eaa9..5cc2569f 100644 --- a/src/nxt_conf_validation.c +++ b/src/nxt_conf_validation.c @@ -6,6 +6,7 @@ #include <nxt_main.h> #include <nxt_conf.h> +#include <nxt_application.h> typedef struct { @@ -213,11 +214,20 @@ static nxt_int_t nxt_conf_vldt_app(nxt_conf_value_t *conf, nxt_str_t *name, nxt_conf_value_t *value) { - nxt_str_t type; - nxt_conf_value_t *type_value; + nxt_str_t type; + nxt_uint_t n; + nxt_thread_t *thread; + nxt_conf_value_t *type_value; + nxt_app_lang_module_t *lang; static nxt_str_t type_str = nxt_string("type"); + static void *members[] = { + nxt_conf_vldt_python_members, + nxt_conf_vldt_php_members, + nxt_conf_vldt_go_members, + }; + type_value = nxt_conf_get_object_member(value, &type_str, NULL); if (nxt_slow_path(type_value == NULL)) { @@ -230,16 +240,16 @@ nxt_conf_vldt_app(nxt_conf_value_t *conf, nxt_str_t *name, nxt_conf_get_string(type_value, &type); - if (nxt_str_eq(&type, "python", 6)) { - return nxt_conf_vldt_object(conf, value, nxt_conf_vldt_python_members); - } + thread = nxt_thread(); - if (nxt_str_eq(&type, "php", 3)) { - return nxt_conf_vldt_object(conf, value, nxt_conf_vldt_php_members); + lang = nxt_app_lang_module(thread->runtime, &type); + if (lang == NULL) { + return NXT_ERROR; } - if (nxt_str_eq(&type, "go", 2)) { - return nxt_conf_vldt_object(conf, value, nxt_conf_vldt_go_members); + n = nxt_app_parse_type(&lang->type); + if (n != NXT_APP_UNKNOWN) { + return nxt_conf_vldt_object(conf, value, members[n]); } return NXT_ERROR; |