How to manage application config?

30 views
Skip to first unread message

Yan Gabriel Minário

unread,
Jun 22, 2017, 2:10:08 PM6/22/17
to openresty-en
Right now I’m importing a config module at the top of my content_by_lua that looks somewhat like this:

local json = require 'cjson'
return {
bot_api_key = os.getenv("TG_TOKEN"),
superadmins = json.decode(os.getenv(“SUPERADMINS")),
}

I wonder if this module is being cached or is it running countless ‘os.getenv’ calls on every request and/or if there’s any better way to manage application config on openresty.

Robert Paprocki

unread,
Jun 22, 2017, 2:11:25 PM6/22/17
to openre...@googlegroups.com
If the data is read-only, you can share it simply as a public Lua module member: https://github.com/openresty/lua-nginx-module#data-sharing-within-an-nginx-worker

--
You received this message because you are subscribed to the Google Groups "openresty-en" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openresty-en+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages