Mon, 22 Nov 2021 12:16:17 +0000
Upgrade runtime environment to Debian bullseye
local lfs = require "lfs"; local function readfile(filename) local fh = assert(io.open(filename)); local data = fh:read("*a"); fh:close(); return data; end local _M = {}; local template_base_path = (os.getenv("TEMPLATE_PATH") or ".").."/"; function _M.init(config) local templates = {}; local template_path = template_base_path..(config.templates or "html"); for filename in lfs.dir(template_path) do local template_name = filename; if filename:match("%.html$") then template_name = filename:gsub("%.html$", ""); end templates[template_name] = readfile(template_path.."/"..filename); end return templates; end return _M;