goherence/internal/module/builtin/register.go
2026-09-11 10:17:25 +03:00

21 lines
1.1 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package builtin
import "github.com/vladimir/goherence/internal/module"
// RegisterAll добавляет все builtin-модули первой версии в реестр.
// Единственное место, которое нужно трогать при добавлении нового модуля —
// сам модуль остаётся в отдельном файле по одному на модуль (см. shell.go,
// copy.go, apt.go и т.д.), а не сваливается всё в один monolith-modules.go.
func RegisterAll(reg *module.Registry, hostVars map[string]interface{}) {
reg.RegisterBuiltin(&ShellModule{})
reg.RegisterBuiltin(&CommandModule{})
reg.RegisterBuiltin(&CopyModule{})
reg.RegisterBuiltin(&TemplateModule{Vars: hostVars})
reg.RegisterBuiltin(&AptModule{})
reg.RegisterBuiltin(&PackageRPMModule{})
reg.RegisterBuiltin(&FileModule{})
reg.RegisterBuiltin(&SystemdModule{})
osFamily, _ := hostVars["os_family"].(string) // пусто, если факты не собирались — см. package.go
reg.RegisterBuiltin(&PackageModule{OSFamily: osFamily})
}