From: "gmx" on
Dear list,

In our postfix configs, we use multiple queries based on the mysql_table
from the same DB .

So as per http://www.postfix.org/mysql_table.5.html each of the mysql config
files contains a

hosts = mydbhost.domain.tld
user = mydbUser
password = myPassword
dbname = myDB

section before the query.
Once any of these parameters needs to be changed, the values need to be
changed repetitively for each query.

If the query file format would allow for
<<
import=/etc/postfix/mysql/dbConf.cf
>>

What do you think of this "Request for enhancement"?

Ralf

From: Jeroen Geilman on
On 06/03/2010 05:35 PM, gmx wrote:
> Dear list,
>
> In our postfix configs, we use multiple queries based on the mysql_table
> from the same DB .
>
> So as per http://www.postfix.org/mysql_table.5.html each of the mysql config
> files contains a
>
> hosts = mydbhost.domain.tld
> user = mydbUser
> password = myPassword
> dbname = myDB
>
> section before the query.
> Once any of these parameters needs to be changed, the values need to be
> changed repetitively for each query.
>
No. Just change the query.
> If the query file format would allow for
> <<
> import=/etc/postfix/mysql/dbConf.cf
>
> What do you think of this "Request for enhancement"?
>
> Ralf
>
>
I don't see any need for that; SQL is so much more flexible than postfix
with regards to table lookups, it's hard to think of a situation were
all data is in SQL and you cannot construct a query to retrieve any
possible combination of data you require.

J.

From: "Pau Amma" on
On Thu, June 3, 2010 3:35 pm, gmx wrote:
> So as per http://www.postfix.org/mysql_table.5.html each of the mysql
> config files contains a
>
> hosts = mydbhost.domain.tld
> user = mydbUser
> password = myPassword
> dbname = myDB
>
> section before the query.
> Once any of these parameters needs to be changed, the values need to be
> changed repetitively for each query.
>
> If the query file format would allow for
> <<
> import=/etc/postfix/mysql/dbConf.cf
> >>

No need. Can be done very easily with a makefile. Something like:

/etc/postfix/mysql/Makefile:
all: foo.cf bar.cf

foo.cf: dbConf.cf.in foo.cf.in
cat dbConf.cf.in foo.cf.in > foo.cf

bar.cf: dbConf.cf.in bar.cf.in
cat dbConf.cf.in bar.cf.in > bar.cf

Then each time you change dbConf.cf.in, foo.cf.in, or bar.cf.in, do:

cd /etc/postfix/mysql
make all
(then reload or restart postfix as you would normally)

From: Victor Duchovni on
On Thu, Jun 03, 2010 at 06:00:26PM -0000, Pau Amma wrote:

> foo.cf: dbConf.cf.in foo.cf.in
> cat dbConf.cf.in foo.cf.in > foo.cf

Make that:

foo.cf: dbConf.cf.in foo.cf.in
$(RM) -f foo.cf.tmp
cat dbConf.cf.in foo.cf.in > foo.cf.tmp
mv foo.cf.tmp foo.cf

automated code must be robust, and so must not overwrite configuration
files directly. For full reliability, that "cat" can be replaced by
something that "fsync()s" the output file.

--
Viktor.

From: "Pau Amma" on
On Thu, June 3, 2010 6:31 pm, Victor Duchovni wrote:
> On Thu, Jun 03, 2010 at 06:00:26PM -0000, Pau Amma wrote:
>
>> foo.cf: dbConf.cf.in foo.cf.in
>> cat dbConf.cf.in foo.cf.in > foo.cf
>
> Make that:
>
> foo.cf: dbConf.cf.in foo.cf.in
> $(RM) -f foo.cf.tmp
> cat dbConf.cf.in foo.cf.in > foo.cf.tmp
> mv foo.cf.tmp foo.cf
>
> automated code must be robust, and so must not overwrite configuration
> files directly. For full reliability, that "cat" can be replaced by
> something that "fsync()s" the output file.

I stand corrected.

:goes back to his sandbox.