flatten an nginx config file by inlining all includes recursively,
save to <output_file>
save to `<output_file>`
-`clean-directory`:
generate a cleaned nginx config directory, containing only the files that
are included from the input file, or files included from those, and so on;
output to <output_directory>
output to `<output_directory>`
Imporant caveats:
-`input_file`*must* exist (if it doesn't the script will exit with an error)
-`output_file`/`output_directory`*must not* exist (if it does, the script will exit with an error)
-`<input_file>`*must* exist (if it doesn't the script will exit with an error)
-`<output_file>`/`<output_directory>`*must not* exist (if it does, the script will exit with an error)
## Operation
...
...
@@ -31,7 +31,7 @@ The script creates a temporary directory (`/tmp/nginx-conf-flatten.????`) and wo
Once output is ready (either in the form of a single flattened `nginx` config file if mode was `flatten`, or a directory structure if it was `clean-directory`), it is moved to the correct location and the temporary directory is removed.
The `flatten` mode makes an honest attempt at keeping indentation sane. This means looking at an `include` line, and indenting the text included from the relevant files by whatever indent was there in the `include` line. This seems to work reasonably well, but if you want the config to be linted and nicely formatted, use a linter and a formatter.
The `flatten` mode makes an honest attempt at keeping indentation sane. This means looking at an `include` line, and indenting the text included from the relevant files by whatever indent was there in the `include` line. This seems to work reasonably well, but if you want the config to be linted and nicely formatted, use a linter and [a formatter](https://github.com/1connect/nginx-config-formatter).
echo-e"\n$CI_INDENT############################################################\n$CI_INDENT### end $CI_FILE_GLOB\n$CI_INDENT############################################################">>"$NGINX_CONFIG_COPY.$DATE_EXT"