Nginx

Nginx module for Augeas

Authors: Ian Berry ibe.nosp@m.rry@barrac.nosp@m.uda.com Raphael Pinson raphael.nosp@m..pinson@camptoc.nosp@m.amp.com

Summary
NginxNginx module for Augeas
ReferenceThis module was built to support a limited subset of nginx configuration syntax.
LicenseThis file is licenced under the LGPL v2+, like the rest of Augeas.
Lens UsageTo be documented
Configuration filesThis lens applies to /etc/nginx/nginx.conf.
ExamplesThe Test_Nginx file contains various examples and tests.
TODO
Augeas Variables
word
block_reThe keywords reserved for block entries
Augeas Lenses
simpleA simple entry
serverA simple server entry
blockA block containing simple entries
lns
Augeas Variables
filter

Reference

This module was built to support a limited subset of nginx configuration syntax.  It works fine with simple blocks and field/value lines.

License

This file is licenced under the LGPL v2+, like the rest of Augeas.

Lens Usage

To be documented

Configuration files

This lens applies to /etc/nginx/nginx.conf.  See filter.

Examples

The Test_Nginx file contains various examples and tests.

TODO

  • Convert statement keyworks for a regex
  • Support more advanced block syntax (location)

Augeas Variables

word

let word = /[A-Za-z0-9_.:-]+/

block_re

let block_re = "http" | "events" | "server" | "mail" | "stream"

The keywords reserved for block entries

Augeas Lenses

simple

let simple = let kw = word - block_re_all in let mask = [ label "mask" . Util.del_str "/" . store Rx.integer ] in let sto = store /[^ \t\n;][^;]*/ . Sep.semicolon in [ Util.indent . key kw . mask? . Sep.space . sto . (Util.eol|Util.comment_eol) ]

A simple entry

server

let server = [ Util.indent . label "@server" . Util.del_str "server" . [ Sep.space . label "@address" . store word ] . [ Sep.space . key word . (Sep.equal . store word)? ]* . Sep.semicolon . (Util.eol|Util.comment_eol) ]

A simple server entry

block

let block (entry : lens) = [ Util.indent . block_head . Build.block_newlines entry Util.comment . Util.eol ]

A block containing simple entries

lns

let lns = ( Util.comment | Util.empty | directive )*

Augeas Variables

filter

Provides unit tests and examples for the Nginx lens.
let word = /[A-Za-z0-9_.:-]+/
let block_re = "http" | "events" | "server" | "mail" | "stream"
The keywords reserved for block entries
let simple = let kw = word - block_re_all in let mask = [ label "mask" . Util.del_str "/" . store Rx.integer ] in let sto = store /[^ \t\n;][^;]*/ . Sep.semicolon in [ Util.indent . key kw . mask? . Sep.space . sto . (Util.eol|Util.comment_eol) ]
A simple entry
let server = [ Util.indent . label "@server" . Util.del_str "server" . [ Sep.space . label "@address" . store word ] . [ Sep.space . key word . (Sep.equal . store word)? ]* . Sep.semicolon . (Util.eol|Util.comment_eol) ]
A simple server entry
let block (entry : lens) = [ Util.indent . block_head . Build.block_newlines entry Util.comment . Util.eol ]
A block containing simple entries
let lns = ( Util.comment | Util.empty | directive )*
Close