view util/envload.lua @ 14219:7f4fcbb1bbe4 13.0

certmanager: Drop embedded Mozilla TLSRef data in favour of util.tlsref This adds a 'tls_profile_version' configuration option. If unspecified, it will use the default profile version from util.tlsref. If specified, it must be either a valid version (known to util.tlsref) or the value "latest". This allows admins to pin to specific versions, go with the default (for the best balance between security/stability) or always use the latest available profiles.
author Matthew Wild <mwild1@gmail.com>
date Fri, 12 Jun 2026 13:04:23 +0100
parents d1aacc6a81ac
children
line wrap: on
line source

-- Prosody IM
-- Copyright (C) 2008-2011 Florian Zeitz
--
-- This project is MIT/X11 licensed. Please see the
-- COPYING file in the source package for more information.
--
-- luacheck: ignore 113/setfenv 113/loadstring

local load = load;
local io_open = io.open;

local function envload(code, source, env)
	return load(code, source, nil, env);
end

local function envloadfile(file, env)
	local fh, err, errno = io_open(file);
	if not fh then return fh, err, errno; end
	local f, err = load(fh:lines(2048), "@" .. file, nil, env);
	fh:close();
	return f, err;
end

return { envload = envload, envloadfile = envloadfile };