Magnus Bäck a écrit :
> On Tue, May 26, 2009 9:30 am, Peter Sørensen said:
> 
>> I want to be able to change the Mysql hostname in a
>> mysql...cf file like this:
>>
>> user = postfix
>> pass = xxxxxxx
>> hosts        = mxdb1.xxx.xxx
>> ......
>> ......
>>
>> kkkkk
>>
>> CHANGE THE HOSTNAME TO mxdb2.xxx.xxx
>>
>>
>> This is referenced in the main.cf like:
>>
>> check_sender_access: proxy:mysql:/xxxx/xxxx/mysql.....cf
>>
>> I would prefer that it was possible to supply some kind of variable name
>> because I have to change this in several mysql.....cf files.
>>
>> I would prefer an ENVIROMENT variable.
>>
>> Would that be possible??
> 
> Postfix does not have such functionality built in -- unless I'm completely
> off mark and lookup table configuration files can refer to any main.cf
> variable.
> 
> Define a suitable DNS alias (perhaps in a zone with short refresh time) or
> generate the config files based on template files with substitution
> variables. Make is your friend.
> 

indeed:

$ cat main.cf
...
maps_directory = /etc/postfix/maps
mysql = proxy:mysql:/etc/postfix/maps/mysql
...
foo_maps = ${mysql}/foo
...

$ cat maps/virtual_alias.mysql
query =
      SELECT
                destination
      FROM
                Virtual_Alias
      WHERE
                alias = '%s'
      ;

$ cat maps/mysql.conf
hosts = ...
user = ....
password = ...
dbname = ....


and the Makefile contains:

mysql/%: mysql.conf %.mysql
        cat $^ > $...@.tmp && mv $...@.tmp $@



Reply via email to