add check to prevent empty module Id

This commit is contained in:
Joel Wetzell
2026-02-02 12:51:56 -06:00
parent a17be985e6
commit c75a2327d5

View File

@@ -34,6 +34,18 @@ func NewRouter(config config.Config) (*Router, []module.ModuleError, []route.Rou
for moduleIndex, moduleDecl := range config.Modules {
if moduleDecl.Id == "" {
if moduleErrors == nil {
moduleErrors = []module.ModuleError{}
}
moduleErrors = append(moduleErrors, module.ModuleError{
Index: moduleIndex,
Config: moduleDecl,
Error: errors.New("module id cannot be empty"),
})
continue
}
moduleInfo, ok := module.ModuleRegistry[moduleDecl.Type]
if !ok {
if moduleErrors == nil {