httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yann Ylavic <ylavic....@gmail.com>
Subject Re: [users@httpd] setting getting variable to be changed in production and read in my C module
Date Wed, 20 Sep 2017 11:16:33 GMT
On Wed, Sep 20, 2017 at 1:11 PM, Yann Ylavic <ylavic.dev@gmail.com> wrote:
> On Wed, Sep 20, 2017 at 12:58 PM, Yann Ylavic <ylavic.dev@gmail.com> wrote:
>> On Wed, Sep 20, 2017 at 11:55 AM, eeadev dev <eeadev@gmail.com> wrote:
>>> I have to write a set of variable to be read from my C module. Those
>>> variable could be change when the code is in production, similar to what u
>>> would write in a java properties file.
>>>
>>> What is the proper way to do it and which functions to use?
>>>
>>> write the in the httpd.conf (what is the API for getting/setting a var
>>> visible in all the apache web server)
>>
>> You could:
>>   Define VAR_NAME "some_value"
>> in "httpd.conf" and then:
>>   const char *var_value = ap_resolve_env(some_pool, "VAR_NAME");
>> in your module for example.
>
> Hmm, actually you'd have to use (note the leading $):
>    const char *var_value = ap_resolve_env(some_pool, "$VAR_NAME");
> in your module.

OK, sorry for not having looked at ap_resolve_env() more thoroughly first.

What you'd have to use in your module is in fact:
    const char *var_value = ap_resolve_env(some_pool, "${VAR_NAME}");

>
> So it may not be appropriate if "VAR_NAME" was instead a C variable
> like var_name (which you'd have to prefix...).

This still stands, even worse (prefix + suffix).

But maybe simple enough if you'll only use string literals...

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message