Krzysztof Trybowski:
> On Mon, Jun 11, 2012 at 2:24 PM, Wietse Venema <wie...@porcupine.org> wrote:
> 
> > On the Postfix side, you usually need one .cf file per Postfix map.
> >
> > On the MySQL side, you can store everything in one table.
> >
> > ? ? ? ?Wietse
> 
> Yes, I use several Postfix maps, so I have several .cf files. And in
> each of them ? database credentials. That's what I was hoping to
> avoid, and store database credentials in one place (one file) only.

In the following, the Postfix configuration files postfix-map1.cf
and postfix-map2.cf are automatically created from a file credentials.cf
(with login and password) and files that have the non-login
information.

    $ cat makefile
    all:        postfix-map1.cf postfix-map2.cf

    postfix-map1.cf: postfix-map1-base.cf credentials.cf
            cat postfix-map1-base.cf credentials.cf >postfix-map1.cf.tmp
            mv postfix-map1.cf.tmp postfix-map1.cf

    postfix-map2.cf: postfix-map2-base.cf credentials.cf
            cat postfix-map2-base.cf credentials.cf >postfix-map2.cf.tmp
            mv postfix-map2.cf.tmp postfix-map2.cf

Edit credentials.cf (with login credentials). Then use "make" to
update all postfix config files.

    $ vi credentials.cf
    $ make
    cat postfix-map1-base.cf credentials.cf >postfix-map1.cf.tmp
    mv postfix-map1.cf.tmp postfix-map1.cf
    cat postfix-map2-base.cf credentials.cf >postfix-map2.cf.tmp
    mv postfix-map2.cf.tmp postfix-map2.cf

Edit postfix-map1-base.cf only, then use "make" to
update postfix-map1.cf.

    $ vi postfix-map1-base.cf
    $ make
    cat postfix-map1-base.cf credentials.cf >postfix-map1.cf.tmp
    mv postfix-map1.cf.tmp postfix-map1.cf

You can use "make" to automate many things.

        Wietse

Reply via email to