Also the configuration file I was referring to in the previous email is not
the haproxy config. it is a different file that contains some json configs.
Sorry for the confusion.

On Wed, May 26, 2021 at 8:14 PM reshma r <[email protected]> wrote:

> Hi, thank you for the quick response
> @Chipitsine This is where I read the recommendation:
> https://www.haproxy.com/blog/5-ways-to-extend-haproxy-with-lua/ -
> (search for register_init
> in this).
>
> @Lukas
> >> Are you talking about writing to the filesystem from a LUA scripts or
> other runtime code within haproxy?
>
> Yes, this was what I was trying to do. I wanted to update the file from
> within haproxy action. Thank you for the clarification.
>
> >>Explaining what the problem is you are trying to solve can get you
> more accurate proposals and solutions faster than asking about a
> particular solution (XY problem).
> Sorry for the lack of detail. It is a bit complicated but I will try to
> explain. I am routing some data through spoe filter to an endpoint
> for analysis and the data to be sent is determined by reading the
> configuration file (for example-whether a certain value is to be sent or
> not). There is a requirement that the configuration file may be changed
> from an external portal. So whenever a change is made in the portal I would
> like to update my configuration file accordingly. To do this, I am making a
> socket call which periodically checks whether the portal has been changed
> (from within haproxy action). If so I must write the updated values to the
> file and it seems I cannot write to a file inside lua action so this is
> where I am stuck. To me, It sounds like this cannot be achieved and I must
> drop the idea of changing the file from the portal.
>
> Thank you.
>
> On Wed, May 26, 2021 at 6:47 PM Lukas Tribus <[email protected]> wrote:
>
>> Hello,
>>
>> On Wed, 26 May 2021 at 13:29, reshma r <[email protected]> wrote:
>> >
>> > Hello all,
>> > Periodically I need to write some configuration data to a file.
>> > However I came across documentation that warned against writing to a
>> file at runtime.
>> > Can someone give me advice on how I can achieve this safely?
>>
>> You'll have to elaborate what you are talking about.
>>
>> Are you talking about writing to the filesystem from a LUA scripts or
>> other runtime code within haproxy? Then yes, don't do it, it will
>> block the event loop and you will be in a world of hurt.
>> Are you talking about writing and changing the configuration file,
>> prior to a reload, manually or from a external process, that's not a
>> problem at all.
>>
>> The issue is blocking filesystem access in the event-loop of the
>> haproxy process itself.
>>
>> Explaining what the problem is you are trying to solve can get you
>> more accurate proposals and solutions faster than asking about a
>> particular solution (XY problem).
>>
>>
>> Lukas
>>
>

Reply via email to