Generate your Nginx configuration files using Dhall.
Loosely based on torbencarstens/dhall-nginx.
let ng = https://raw.githubusercontent.com/denizdogan/dhall-nginx/v0.2/package.dhall
in ng.config::{ ... }
See example 1 and its accompanying .conf file for example input and output.
$ dhall text --file config.dhall
The easiest way to get started is probably by looking at the examples in _tests where you can find pairings of Dhall input files and their output Nginx configurations. Note that some of the output files will look slightly different from what they were based on, because this library doesn't support e.g. include
directives -- instead of that, just use Dhall's mechanisms to "include" parts.
- nginx - Full Example Configuration
- ruby_fcgi - Simple Ruby FCGI
- simple_load_balancing - Simple Load Balancing
- wordpress - Wordpress recipe
Additionally, there is:
- example - a random configuration for testing purposes
Since the internal order of the allow
and deny
directives matters, they are configured as a list of "access rules". Their common type is called access_rule
.
A Dhall version of the default /etc/nginx/fastcgi_params has been included in utils/helpers/fastcgi_params.dhall.
A Dhall version of the default mime.types has been included in utils/helpers/mime_types.dhall.
- Help wanted: No nested
location
blocks because recursion is hard in Dhall, and named locations cannot have sub-location blocks, making it even harder. - Not going to happen: No
if
statements: because if is evil, and it would turn the configuration file into an imperative script rather than a declarative description.
$ make format # format all files
$ make freeze # freeze all imports
$ make lint # lint all files
$ make test # run all tests