5 Author: Raphael Pinson <raphink@gmail.com>
8 http://www.postgresql.org/docs/current/static/config-setting.html
11 This file is licenced under the LGPL v2+, like the rest of Augeas.
16 About: Configuration files
17 This lens applies to postgresql.conf. See <filter>.
20 The <Test_Postgresql> file contains various examples and tests.
28 Key and values are separated
29 by either spaces or an equal sign *)
30 let sep = del /([ \t]+)|([ \t]*=[ \t]*)/ " = "
32 (* Variable: word_opt_quot_re
33 Strings that don't require quotes *)
34 let word_opt_quot_re = /[A-Za-z][A-Za-z0-9_-]*/
36 (* View: word_opt_quot
37 Storing a <word_opt_quot_re>, with or without quotes *)
38 let word_opt_quot = Quote.do_squote_opt (store word_opt_quot_re)
40 (* Variable: number_re
41 A relative decimal number, optionally with unit *)
42 let number_re = Rx.reldecimal . /[kMG]?B|[m]?s|min|h|d/?
45 Storing <number_re>, with or without quotes *)
46 let number = Quote.do_squote_opt (store number_re)
49 Anything other than <word_opt_quot> or <number>
50 Quotes are mandatory *)
52 let esc_squot = /\\\\'/
53 in let no_quot = /[^#'\n]/
54 in let forbidden = word_opt_quot_re | number_re
55 in let value = (no_quot|esc_squot)* - forbidden
56 in Quote.do_squote (store value)
59 Builder to construct entries *)
60 let entry_gen (lns:lens) =
61 Util.indent . Build.key_value_line_comment Rx.word sep lns Util.comment_eol
64 let entry = entry_gen number
65 | entry_gen word_opt_quot
66 | entry_gen word_quot (* anything else *)
69 let lns = (Util.empty | Util.comment | entry)*
71 (* Variable: filter *)
72 let filter = (incl "/var/lib/pgsql/data/postgresql.conf" .
73 incl "/var/lib/pgsql/*/data/postgresql.conf" .
74 incl "/var/lib/postgresql/*/data/postgresql.conf" .
75 incl "/etc/postgresql/*/*/postgresql.conf" )
77 let xfm = transform lns filter