Re: Parsing config files in a directory

From: Thom Brown <thombrown(at)gmail(dot)com>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Simon Riggs <simon(at)2ndquadrant(dot)com>, Greg Smith <gsmith(at)gregsmith(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Greg Stark <gsstark(at)mit(dot)edu>, Magnus Hagander <magnus(at)hagander(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Parsing config files in a directory
Date: 2009-10-29 12:31:55
Message-ID: bddc86150910290531x625907e0k8da083362e452b13@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2009/10/29 Andrew Dunstan <andrew(at)dunslane(dot)net>:
>
>
> Pavel Stehule wrote:
>>
>> 2009/10/27 Simon Riggs <simon(at)2ndquadrant(dot)com>:
>>
>>>
>>> On Tue, 2009-10-27 at 00:38 -0400, Greg Smith wrote:
>>>
>>>>
>>>> new feature
>>>>
>>>
>>> One additional point that would be useful is a way to match up the usage
>>> of custom_variable_classes with this new style of .conf file processing.
>>>
>>> At the moment if you wish to add a custom variable class everybody needs
>>> to edit the *same* parameter. Finding which one to edit could be a
>>> little difficult with a whole directory to search in.
>>>
>>> I propose a new form of processing for that variable: each new parameter
>>> instance is added to last one, rather than replacing it.
>>> e.g.
>>> custom_variable_class = 'x'
>>> custom_variable_class = 'y'
>>> custom_variable_class = 'z'
>>> is equivalent to
>>> custom_variable_classes = 'x,y,z'
>>>
>>> That allows NewFeatureX to drop in a file called "newfeaturex.conf",
>>> which looks like this
>>>
>>> custom_variable_class = 'newfeaturex'
>>> newfeaturex.param1 = x
>>> newfeaturex.param2 = y
>>> newfeaturex.param3 = z
>>>
>>> This requires no editing of any other files, just a straight drop in.
>>> That will make it much easier to produce real installers/deinstallers
>>> for add-in modules.
>>>
>>
>> I understand, but this behave is confusing. Maybe better is using some
>> trivial keywords like append, delete, reset
>>
>> so
>> append custom_variable_class = 'x'
>> append custom_variable_class = 'y'
>> append custom_variable_class = 'z'
>>
>> is custom_variable_classes = 'x,y,z'
>>
>>
>
> Why not allow something like += or .= instead of the = to denote appending
> to a list?
>
>   custom_variable_classes += 'x'
>
> seems a whole lot nicer to me.
>

I would see that as making the config more programatic so while that
might not look too weird to a developer, it could be confusing for a
DBA or system administrator. I don't think that's how config files
should work, and it also adds gotchas like the following.

custom_variable_classes = 'x'
custom_variable_classes += 'y'
custom_variable_classes = 'z'

That would result in the first 2 assignments being undone.

Regards

Thom

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2009-10-29 12:56:22 Re: Parsing config files in a directory
Previous Message Pavel Stehule 2009-10-29 12:31:17 Re: Parsing config files in a directory