# HG changeset patch # User Kim Alvefur # Date 1404394346 -7200 # Node ID 0033b021038f3126c1816adb34c3d5c4aec3155a # Parent 851fb5e9fa0ce009b00dbff1c9e878e4408b6df9 core.certmanager: Make create_context() support an arbitrary number of option sets, merging all diff -r 851fb5e9fa0c -r 0033b021038f core/certmanager.lua --- a/core/certmanager.lua Thu Jul 03 15:31:12 2014 +0200 +++ b/core/certmanager.lua Thu Jul 03 15:32:26 2014 +0200 @@ -16,6 +16,7 @@ local pairs = pairs; local type = type; local io_open = io.open; +local select = select; local prosody = prosody; local resolve_path = require"util.paths".resolve_relative_path; @@ -62,7 +63,7 @@ end end -function create_context(host, mode, user_ssl_config) +function create_context(host, mode, ...) if not ssl then return nil, "LuaSec (required for encryption) was not found"; end local cfg = new_config(); @@ -73,9 +74,11 @@ -- We can't read the password interactively when daemonized password = function() log("error", "Encrypted certificate for %s requires 'ssl' 'password' to be set in config", host); end; }); - cfg:apply(user_ssl_config); - user_ssl_config = cfg:final(); + for i = select('#', ...), 1, -1 do + cfg:apply(select(i, ...)); + end + local user_ssl_config = cfg:final(); if mode == "server" then if not user_ssl_config.key then return nil, "No key present in SSL/TLS configuration for "..host; end