You can simply use a a global variable in the lua script to store the
configuration information

And you can initialize that in the __init__ function, which is run at
the start of the server.

You can see some examples.
here - 
https://docs.trafficserver.apache.org/en/latest/admin-guide/plugins/lua.en.html#ts-stat-create
and here - 
https://docs.trafficserver.apache.org/en/latest/admin-guide/plugins/lua.en.html#example-scripts

On Wed, Jul 13, 2022 at 12:00 PM Walt Karas <wka...@yahooinc.com.invalid> wrote:
>
> There is a way to do this in the C API (global arguments with
> TSUserArgSet/Get).  But it doesn't look like these functions are supported
> in the Lua API.  Can you keep the data in a file, perhaps on a RAM disk to
> make access fast?
>
> On Wed, Jul 13, 2022 at 4:41 AM Vishal Garg <gar...@media.net.invalid>
> wrote:
>
> > Hey,
> > ATS Version: v9.1
> > OS: Ubuntu 22.04
> >
> > I am writing a Lua plugin to allow custom rate limiting logic.
> > Right now each request has its own Lua state and thus no variables are
> > shared.
> >
> > I want to have a piece of config loaded which is read only and shared
> > across all requests coming in.
> > Current implementation loads config from Redis on each request and stores
> > it in ctx to be used in multiple stages of a request.
> >
> > Is there a global variable available in Lua which I can initialize for the
> > entire lifetime of ATS running and can be accessed by all requests?
> >
> > Thanks in advance
> > --
> > *Vishal Garg*
> > Site Reliability Engineer II
> > Autoopt-3
> >

Reply via email to