Re: [PATCΗ] Quoted values in squid.conf

From: Alex Rousskov <rousskov_at_measurement-factory.com>
Date: Fri, 31 May 2013 11:14:35 -0600

On 05/31/2013 10:05 AM, Tsantilas Christos wrote:
> On 05/27/2013 07:12 PM, Alex Rousskov wrote:
>> On 05/27/2013 04:54 AM, Tsantilas Christos wrote:
>>> On 05/26/2013 10:05 PM, Kinkie wrote:
>>>>>> The only thing I would like to see differently implemented is the
>>>>>> syntax used to include files:
>>>>>> file(path) would be IMO easier to understand and less prone to
>>>>>> confusion than the proposed syntax.
>>>>>
>>>>> OK.
>>>>> But imagine in the future also the following syntax:
>>>>> file:/path/file
>>>>> system:/usr/local/squid/bin/my-squid-conf (to read from an executable
>>>>> stdout configuration options)
>>>>> http://hostname/cfgfile (to get from web page configuration)
>>>>>
>>>>> All the above can be implemented in the future...
>>>>
>>>> Sure, I agree.
>>>>
>>>> file(/path/file)
>>>> system(/some/executable)
>>>> http_get(http://hostname/file)
>>>
>>> Well, this is not a bad scheme :-)
>>>
>>> Just the file:/path/to/file a little easier to implement. But not
>>> something important...
>>
>>
>> I agree that file() is a good alternative. Amos (and others), do you
>> have a preference between
>>
>> file:"/path/file"
>>
>> and
>>
>> file("/path/file")
>>
>>
>> syntax?
>>
>
> About these two schemes I have a different suggestion.
> Some opensource packages using the "file:/" or "db:/" for dynamic data.
>
> I do not know if it make sense for squid but I am suggesting the
> following scheme
> 1) Use the file("path") syntax for configuration file parsing
> 2) preserve the file:/ or db:/ etc for dynamic data. For example acls
> values stored in bdb or sql server.

Stepping back a little, I think there are two big problems with the "URL
scheme-like" approaches (file:, db:, etc.):

1) They combine the method of access (local file, HTTP, database query,
etc.) with the meaning of the received information (configuration values
to use now or configuration values to interpret at the time of directive
use). With function-like style, this is not a problem:

  # static configurations to use now:
  parameters("/usr/local/etc/config.txt")
  parameters("http://example.com/config.txt")
  parameters("db:config_table")

  # dynamically updated configuration:
  dynamic_parameters("/usr/local/etc/config.txt")
  dynamic_parameters("http://example.com/config.txt")
  dynamic_parameters("db:config_table")

2) They make it difficult to add other options/parameters for that
access (e.g., HTTP request method or database reload frequency). With
function-like style, this is not a problem:

  parameters("http://example.com/config.txt", method=QUERY)
  dynamic_parameters("db:config_table", reload_frequency=1s)

Thus, while file() is probably the wrong function name (because it
implies a specific access method while it should focus on how the
received data is used), I suggest that we use function-like style.

Alex.
Received on Fri May 31 2013 - 17:14:41 MDT

This archive was generated by hypermail 2.2.0 : Fri May 31 2013 - 12:00:14 MDT