Comparison

core/configmanager.lua @ 12448:fb7e76c1ad1c 0.12

configmanager: Clearer errors when providing unexpected values after VirtualHost (fixes #1735, thanks arawaks)
author Matthew Wild <mwild1@gmail.com>
date Sun, 03 Apr 2022 12:56:11 +0100
parent 12440:1ef893715311
child 12531:32bcb899526f
comparison
equal deleted inserted replaced
12446:e54b8a5e35ad 12448:fb7e76c1ad1c
158 rawset(env, "__currenthost", name); 158 rawset(env, "__currenthost", name);
159 -- Needs at least one setting to logically exist :) 159 -- Needs at least one setting to logically exist :)
160 set(config_table, name or "*", "defined", true); 160 set(config_table, name or "*", "defined", true);
161 return function (config_options) 161 return function (config_options)
162 rawset(env, "__currenthost", "*"); -- Return to global scope 162 rawset(env, "__currenthost", "*"); -- Return to global scope
163 if type(config_options) == "string" then
164 error(format("VirtualHost entries do not accept a module name (module '%s' provided for host '%s')", config_options, name), 2);
165 elseif type(config_options) ~= "table" then
166 error("Invalid syntax following VirtualHost, expected options but received a "..type(config_options), 2);
167 end
163 for option_name, option_value in pairs(config_options) do 168 for option_name, option_value in pairs(config_options) do
164 set(config_table, name or "*", option_name, option_value); 169 set(config_table, name or "*", option_name, option_value);
165 end 170 end
166 end; 171 end;
167 end 172 end