diff --git a/sga/configuration.lua b/sga/configuration.lua index fded807f77bd46976b808069831b17d8d21d260d..c7b0599dd238f0265bfa8ff5b11572ba4635f1a0 100644 --- a/sga/configuration.lua +++ b/sga/configuration.lua @@ -26,24 +26,20 @@ local function get_from_multiple(filename, sga_name, config) if not sga_name then return nil, string.format(err, filename, "missing sga_name argument") end - - if config.sga_name then - -- TODO: Dar erro se config default tiver sga_name - config.sga_name = nil - end - local config_data = config.sga[sga_name] if not config_data then return nil, string.format(err, filename, "'"..sga_name.."' not found") end config.sga = nil -- avoid multiple inside multiple - + config, err = get(config_data, filename, config) if not config then return nil, string.format("[%s] %s", sga_name, err) end + if config.sga_name then + return nil, string.format("sga_name '"..config.sga_name.."' already defined in configuration file "..filename) + end - -- TODO: Dar erro se config do sga escolhido tiver sga_name config.sga_name = sga_name return config