[prev in list] [next in list] [prev in thread] [next in thread] 

List:       apache-httpd-users
Subject:    Re: [users@httpd] setting getting variable to be changed in production and read in my C module
From:       eeadev dev <eeadev () gmail ! com>
Date:       2017-09-20 12:43:11
Message-ID: CAJtbAXkRqYg2mj3YtTgyc=EaWkS+HiSPePCwtPv=gt1NPaiKXg () mail ! gmail ! com
[Download RAW message or body]

actually noone is working "${VAR_NAME}" nor $VAR_NAME nor VAR_NAME

2017-09-20 5:07 GMT-07:00 eeadev dev <eeadev@gmail.com>:

> is there anything similar but related to my module?
> for instance, now I have mymodule.conf I would prefer to write it there
> than in the general conf file, is it possible to define my var there and
> use ap_resolve_env()?
>
> 2017-09-20 4:16 GMT-07:00 Yann Ylavic <ylavic.dev@gmail.com>:
>
>> 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
>>
>>
>

[Attachment #3 (text/html)]

<div dir="ltr">actually noone is working &quot;${VAR_NAME}&quot; nor $VAR_NAME nor \
VAR_NAME<br></div><div class="gmail_extra"><br><div class="gmail_quote">2017-09-20 \
5:07 GMT-07:00 eeadev dev <span dir="ltr">&lt;<a href="mailto:eeadev@gmail.com" \
target="_blank">eeadev@gmail.com</a>&gt;</span>:<br><blockquote class="gmail_quote" \
style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div \
dir="ltr"><div>is there anything similar but related to my module?<br></div>for \
instance, now I have mymodule.conf I would prefer to write it there than in the \
general conf file, is it possible to define my var there and use \
ap_resolve_env()?<br></div><div class="HOEnZb"><div class="h5"><div \
class="gmail_extra"><br><div class="gmail_quote">2017-09-20 4:16 GMT-07:00 Yann \
Ylavic <span dir="ltr">&lt;<a href="mailto:ylavic.dev@gmail.com" \
target="_blank">ylavic.dev@gmail.com</a>&gt;</span>:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><span>On Wed, Sep 20, 2017 at 1:11 PM, Yann Ylavic &lt;<a \
href="mailto:ylavic.dev@gmail.com" target="_blank">ylavic.dev@gmail.com</a>&gt; \
wrote:<br> &gt; On Wed, Sep 20, 2017 at 12:58 PM, Yann Ylavic &lt;<a \
href="mailto:ylavic.dev@gmail.com" target="_blank">ylavic.dev@gmail.com</a>&gt; \
wrote:<br> &gt;&gt; On Wed, Sep 20, 2017 at 11:55 AM, eeadev dev &lt;<a \
href="mailto:eeadev@gmail.com" target="_blank">eeadev@gmail.com</a>&gt; wrote:<br> \
&gt;&gt;&gt; I have to write a set of variable to be read from my C module. Those<br> \
&gt;&gt;&gt; variable could be change when the code is in production, similar to what \
u<br> &gt;&gt;&gt; would write in a java properties file.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; What is the proper way to do it and which functions to use?<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; write the in the httpd.conf (what is the API for getting/setting a \
var<br> &gt;&gt;&gt; visible in all the apache web server)<br>
&gt;&gt;<br>
&gt;&gt; You could:<br>
&gt;&gt;     Define VAR_NAME &quot;some_value&quot;<br>
&gt;&gt; in &quot;httpd.conf&quot; and then:<br>
&gt;&gt;     const char *var_value = ap_resolve_env(some_pool, \
&quot;VAR_NAME&quot;);<br> &gt;&gt; in your module for example.<br>
&gt;<br>
&gt; Hmm, actually you&#39;d have to use (note the leading $):<br>
&gt;      const char *var_value = ap_resolve_env(some_pool, \
&quot;$VAR_NAME&quot;);<br> &gt; in your module.<br>
<br>
</span>OK, sorry for not having looked at ap_resolve_env() more thoroughly first.<br>
<br>
What you&#39;d have to use in your module is in fact:<br>
      const char *var_value = ap_resolve_env(some_pool, &quot;${VAR_NAME}&quot;);<br>
<span><br>
&gt;<br>
&gt; So it may not be appropriate if &quot;VAR_NAME&quot; was instead a C \
variable<br> &gt; like var_name (which you&#39;d have to prefix...).<br>
<br>
</span>This still stands, even worse (prefix + suffix).<br>
<br>
But maybe simple enough if you&#39;ll only use string literals...<br>
<div class="m_-5767578841476647583HOEnZb"><div class="m_-5767578841476647583h5"><br>
------------------------------<wbr>------------------------------<wbr>---------<br>
To unsubscribe, e-mail: <a href="mailto:users-unsubscribe@httpd.apache.org" \
target="_blank">users-unsubscribe@httpd.apache<wbr>.org</a><br> For additional \
commands, e-mail: <a href="mailto:users-help@httpd.apache.org" \
target="_blank">users-help@httpd.apache.org</a><br> <br>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic