Files
ops-assistant/internal/core/ops/bootstrap.go
2026-03-19 21:23:28 +08:00

27 lines
673 B
Go

package ops
import (
"path/filepath"
"ops-assistant/internal/core/registry"
"ops-assistant/internal/core/runbook"
"ops-assistant/internal/module/cf"
"ops-assistant/internal/module/cpa"
"ops-assistant/internal/module/mail"
"gorm.io/gorm"
)
func BuildDefault(db *gorm.DB, dbPath, baseDir string) *Service {
r := registry.New()
exec := runbook.NewExecutor(db, filepath.Join(baseDir, "runbooks"))
cpaModule := cpa.New(db, exec)
cfModule := cf.New(db, exec)
mailModule := mail.New(db, exec)
r.RegisterModule("cpa", cpaModule.Handle)
r.RegisterModule("cf", cfModule.Handle)
r.RegisterModule("mail", mailModule.Handle)
return NewService(dbPath, baseDir, r)
}