diff options
author | Philip Prindeville <philipp@redfish-solutions.com> | 2017-03-22 22:11:27 -0600 |
---|---|---|
committer | Glenn Strauss <gstrauss@gluelogic.com> | 2017-03-23 01:29:05 -0400 |
commit | 367e62c1c29e143267f40e3672d4869d79bfb58d (patch) | |
tree | 43633f83623055bdf75eeaf401dcce0b9749c792 /src/configparser.y | |
parent | ad6c703a51c0db4894846409ae0d039c3985302c (diff) | |
download | lighttpd-git-367e62c1c29e143267f40e3672d4869d79bfb58d.tar.gz |
[core] allow overriding prior config values (fixes #2799)
introduce ":=" config file syntax to replace previously set value
github: closes #78
x-ref:
"allow overriding configuration values"
https://redmine.lighttpd.net/issues/2799
https://github.com/lighttpd/lighttpd1.4/pull/78
Diffstat (limited to 'src/configparser.y')
-rw-r--r-- | src/configparser.y | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/configparser.y b/src/configparser.y index 9def054f..66165d86 100644 --- a/src/configparser.y +++ b/src/configparser.y @@ -206,6 +206,23 @@ varline ::= key(A) ASSIGN expression(B). { A = NULL; } +varline ::= key(A) FORCE_ASSIGN expression(B). { + if (ctx->ok) { + if (strncmp(A->ptr, "env.", sizeof("env.") - 1) == 0) { + fprintf(stderr, "Setting env variable is not supported in conditional %d %s: %s\n", + ctx->current->context_ndx, + ctx->current->key->ptr, A->ptr); + ctx->ok = 0; + } else { + buffer_copy_buffer(B->key, A); + array_replace(ctx->current->value, B); + B = NULL; + } + } + buffer_free(A); + A = NULL; +} + varline ::= key(A) APPEND expression(B). { if (ctx->ok) { array *vars = ctx->current->value; |