Some new releases and fixes
This commit is contained in:
parent
2192e68775
commit
5c85a7d32f
15 changed files with 132 additions and 85 deletions
|
|
@ -16,10 +16,6 @@ nginx-confgen can be used to do pre-processing for nginx configuration files
|
|||
"compile-time" macro expansion and variable interpolation, which should make it
|
||||
less tedious to maintain large and complex configurations.
|
||||
|
||||
nginx-confgen does not currently support any command-line arguments. It simply
|
||||
reads the configuration from standard input, and writes the processed
|
||||
configuration to standard output.
|
||||
|
||||
nginx-confgen works by parsing the input into a syntax tree, modifying this
|
||||
tree, and then formatting the tree to generate the output. It is completely
|
||||
oblivious to nginx contexts and directives, so it is possible to do nonsensical
|
||||
|
|
@ -111,8 +107,8 @@ new command).
|
|||
=head2 pre_if
|
||||
|
||||
Similar to the C<if> directive in nginx, except that this is evaluated during
|
||||
preprocessing. nginx-confgen has a few warts with regards to parenthesis,
|
||||
things usually work better without:
|
||||
preprocessing. Also unlike C<if>, parenthesis around the arguments are not
|
||||
supported. Some examples:
|
||||
|
||||
pre_if -f $certdir/ocsp.der {
|
||||
ssl_stapling on;
|
||||
|
|
@ -214,68 +210,20 @@ nested macro expansion.
|
|||
=head1 BUGS & WARTS
|
||||
|
||||
nginx-confgen is a quickly written hack to solve a particular use case, it is
|
||||
quite likely to have some weird behavior and bugs. Here's a few I am aware of:
|
||||
quite likely to have some weird behavior and bugs.
|
||||
|
||||
=over
|
||||
|
||||
=item *
|
||||
Comments and whitespace in the input files are thrown away and ignored. The
|
||||
generated output is completely reformatted.
|
||||
|
||||
The nginx configuration syntax is not as regular as I had hoped. It's possible
|
||||
for nginx modules to extend the syntax somewhat. A good example is the I<types>
|
||||
directive in I<ngx_http_core_module>. While nginx-confgen should be able to
|
||||
handle the I<types> directive just fine, other extensions may cause syntax
|
||||
errors or will not survive a round-trip through nginx-confgen.
|
||||
|
||||
This applies to all I<*_by_lua_block> directives in the I<ngx_http_lua_module>.
|
||||
The I<_by_lua> directives that accept a string should work just fine.
|
||||
|
||||
=item *
|
||||
|
||||
Be careful with parenthesis around if statements, e.g.:
|
||||
|
||||
if ($a == $b) { }
|
||||
|
||||
Will get converted into:
|
||||
|
||||
if "(${a}" == "${b})" { }
|
||||
|
||||
Which is unlikely what you want. As a workaround, add some spaces:
|
||||
|
||||
if ( $a == $b ) { }
|
||||
|
||||
=item *
|
||||
|
||||
Arguments to directives may get reformatted, especially if they contain a
|
||||
variable. This I<should> not matter in most cases, but in some particular
|
||||
scenarios it does. Here's a few examples of reformatting:
|
||||
|
||||
return 301 http://blicky.net$request_uri;
|
||||
# becomes:
|
||||
return 301 "http://blicky.net${request_uri}";
|
||||
|
||||
add_header Something "${header}";
|
||||
# becomes:
|
||||
add_header Something $header;
|
||||
|
||||
This reformatting may cause different behavior for nginx directives that do not
|
||||
support variable interpolation, such as C<error_log>.
|
||||
|
||||
=item *
|
||||
|
||||
C<pre_if> does not like empty strings, e.g.
|
||||
|
||||
pre_if $x == "" { }
|
||||
|
||||
Will throw an error, use the following instead:
|
||||
|
||||
pre_if $x { }
|
||||
|
||||
=item *
|
||||
|
||||
The error messages aren't always helpful.
|
||||
|
||||
=back
|
||||
|
||||
The error messages given by C<nginx-confgen> aren't always helpful.
|
||||
|
||||
|
||||
=head1 AUTHOR
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue