Configuration of environment variables for application processes.
This commit is contained in:
@@ -62,6 +62,8 @@ static nxt_int_t nxt_conf_vldt_system(nxt_conf_validation_t *vldt,
|
||||
nxt_conf_value_t *value, void *data);
|
||||
static nxt_int_t nxt_conf_vldt_user(nxt_conf_validation_t *vldt, char *name);
|
||||
static nxt_int_t nxt_conf_vldt_group(nxt_conf_validation_t *vldt, char *name);
|
||||
static nxt_int_t nxt_conf_vldt_environment(nxt_conf_validation_t *vldt,
|
||||
nxt_str_t *name, nxt_conf_value_t *value);
|
||||
|
||||
|
||||
static nxt_conf_vldt_object_t nxt_conf_vldt_root_members[] = {
|
||||
@@ -165,6 +167,11 @@ static nxt_conf_vldt_object_t nxt_conf_vldt_common_members[] = {
|
||||
NULL,
|
||||
NULL },
|
||||
|
||||
{ nxt_string("environment"),
|
||||
NXT_CONF_VLDT_OBJECT,
|
||||
&nxt_conf_vldt_object_iterator,
|
||||
(void *) &nxt_conf_vldt_environment },
|
||||
|
||||
NXT_CONF_VLDT_END
|
||||
};
|
||||
|
||||
@@ -724,3 +731,40 @@ nxt_conf_vldt_group(nxt_conf_validation_t *vldt, char *group)
|
||||
|
||||
return NXT_ERROR;
|
||||
}
|
||||
|
||||
|
||||
static nxt_int_t
|
||||
nxt_conf_vldt_environment(nxt_conf_validation_t *vldt, nxt_str_t *name,
|
||||
nxt_conf_value_t *value)
|
||||
{
|
||||
nxt_str_t str;
|
||||
|
||||
if (name->length == 0) {
|
||||
return nxt_conf_vldt_error(vldt,
|
||||
"The environment name must not be empty.");
|
||||
}
|
||||
|
||||
if (nxt_memchr(name->start, '\0', name->length) != NULL) {
|
||||
return nxt_conf_vldt_error(vldt, "The environment name must not "
|
||||
"contain null character.");
|
||||
}
|
||||
|
||||
if (nxt_memchr(name->start, '=', name->length) != NULL) {
|
||||
return nxt_conf_vldt_error(vldt, "The environment name must not "
|
||||
"contain '=' character.");
|
||||
}
|
||||
|
||||
if (nxt_conf_type(value) != NXT_CONF_STRING) {
|
||||
return nxt_conf_vldt_error(vldt, "The \"%V\" environment value must be "
|
||||
"a string.", name);
|
||||
}
|
||||
|
||||
nxt_conf_get_string(value, &str);
|
||||
|
||||
if (nxt_memchr(str.start, '\0', str.length) != NULL) {
|
||||
return nxt_conf_vldt_error(vldt, "The \"%V\" environment value must "
|
||||
"not contain null character.", name);
|
||||
}
|
||||
|
||||
return NXT_OK;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user