package services import ( "context" "github.com/labstack/echo/v4" "sorbet/internal/services/company" "sorbet/internal/services/config" "sorbet/internal/services/feature" "sorbet/internal/services/resource" "sorbet/internal/services/system" "sorbet/pkg/app" ) var applets []app.Applet func Init() { applets = []app.Applet{ &config.Service{}, &company.Service{}, &resource.Service{}, &feature.Service{}, &system.Service{}, } } func Start(ctx context.Context) error { e := ctx.Value("echo_framework").(*echo.Echo) for _, service := range applets { err := service.Init(app.NewContext(ctx, e.Group(""))) if err != nil { return err } err = service.Start() if err != nil { return err } } return nil } func Stop() error { for _, service := range applets { err := service.Stop() if err != nil { return err } } return nil }