-if luasec_has_no_compression and configmanager.get("*", "ssl_compression") ~= true then
- core_defaults.options[#core_defaults.options+1] = "no_compression";
-end
-
-function create_context(host, mode, user_ssl_config)
- user_ssl_config = user_ssl_config or {}
- user_ssl_config.mode = mode;
-
- if not ssl then return nil, "LuaSec (required for encryption) was not found"; end
-
- if global_ssl_config then
- for option,default_value in pairs(global_ssl_config) do
- if not user_ssl_config[option] then
- user_ssl_config[option] = default_value;
- end
- end
+function create_context(host, mode, ...)
+ local cfg = new_config();
+ cfg:apply(core_defaults);
+ cfg:apply(global_ssl_config);
+ cfg:apply({
+ mode = mode,
+ -- 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;
+ });
+
+ for i = select('#', ...), 1, -1 do
+ cfg:apply(select(i, ...));