Skip to content

Instantly share code, notes, and snippets.

@adamjakab
Created April 16, 2021 06:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adamjakab/f5446b53eb07db0a3b8676110521c8a0 to your computer and use it in GitHub Desktop.
Save adamjakab/f5446b53eb07db0a3b8676110521c8a0 to your computer and use it in GitHub Desktop.
--
-- Created by IntelliJ IDEA.
-- User: jackisback
-- Date: 15/04/2021
-- Time: 23.20
-- To change this template use File | Settings | File Templates.
--
-- Reference:
-- https://github.com/openresty/lua-nginx-module#data-sharing-within-an-nginx-worker
-- This module needs to be loaded by the `require()` builtin like this:
-- location /something {
-- content_by_lua_block {
-- local cfgLoader = require "/path/to/configLoaderModule"
-- local cfg = cfgLoader.get()
-- ngx.say("Config: " .. cfg)
-- }
-- }
local _M = {}
local integrationConfigFilePath = "/opt/openresty/nginx/lua_scripts/external_data_loader/config.json"
local integrationConfigFile = io.open(integrationConfigFilePath, "r")
local integrationConfigJson = integrationConfigFile:read("*a")
integrationConfigFile:close()
function _M.get()
return integrationConfigJson
end
return _M
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment