From 288c50ad7885a91adc50618e67af69e6188eeae3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Petr=20=C5=A0pa=C4=8Dek?= Date: Mon, 15 Apr 2019 15:40:27 +0200 Subject: [PATCH] http: new function to merge config sets --- modules/http/http.lua.in | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/modules/http/http.lua.in b/modules/http/http.lua.in index 7bdadb13f..5db6721b9 100644 --- a/modules/http/http.lua.in +++ b/modules/http/http.lua.in @@ -279,6 +279,18 @@ local function updatecert(crtfile, keyfile) return crt, key end +-- @function Merge dictionaries. +-- Values from right-hand side dictionaries take precedence. +function M.mergeconf(...) + local merged = {} + for _, intable in ipairs({...}) do + for key, val in pairs(intable) do + merged[key] = val + end + end + return merged +end + -- @function Listen on given HTTP(s) host function M.add_interface(conf) local crt, key, ephemeral -- 2.47.3