Documentation
¶
Overview ¶
Package di owns the backend's dependency-injection graph. The service construction order is generated by google/wire (see wire.go / wire_gen.go); this file holds the aggregate Services container and the small set of provider wrappers wire cannot synthesize on its own.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var JobSet = wire.NewSet(wire.FieldsOf(new(*Services), "Updater", "Settings", "ImageUpdate", "Environment", "Docker", "KV", "Event", "Activity", "Session", "System", "Notification", "Project", "Template", "Vulnerability", "Volume", ), scheduler.NewAutoUpdateJob, scheduler.NewImageUpdateWatcher, scheduler.NewDockerClientRefreshJob, provideAnalyticsJobInternal, scheduler.NewEventCleanupJob, scheduler.NewPruningVolumeHelperJob, scheduler.NewExpiredSessionsCleanupJob, scheduler.NewScheduledPruneJob, provideFilesystemWatcherJobInternal, scheduler.NewVulnerabilityScanJob, scheduler.NewAutoHealJob, wire.Struct(new(Jobs), "*"), )
JobSet builds every scheduler job from an already-constructed *Services (whose fields are exposed to the graph via wire.FieldsOf) plus the app context and config.
var ServiceSet = wire.NewSet( provideResourcesFSInternal, services.NewEventService, services.NewActivityService, services.NewSettingsService, services.NewKVService, services.NewJobService, services.NewSettingsSearchService, services.NewCustomizeSearchService, services.NewApplicationImagesService, services.NewDockerClientService, services.NewRoleService, services.NewSessionService, services.NewEnvironmentService, services.NewNotificationService, services.NewVulnerabilityService, services.NewImageUpdateService, services.NewImageService, services.NewBuildService, services.NewBuildWorkspaceService, services.NewLifecycleService, provideProjectServiceInternal, services.NewContainerService, services.NewDashboardService, services.NewNetworkService, services.NewPortService, services.NewSwarmService, services.NewTemplateService, services.NewOidcService, services.NewSystemService, services.NewSystemUpgradeService, services.NewDiagnosticsService, services.NewGitOpsSyncService, services.NewWebhookService, services.NewVariableService, provideVersionServiceInternal, provideGitRepositoryServiceInternal, provideVolumeServiceInternal, provideAuthServiceInternal, provideContainerRegistryServiceInternal, provideUpdaterServiceInternal, provideUserServiceInternal, provideApiKeyServiceInternal, provideFederatedCredentialServiceInternal, provideAuthMiddlewareInternal, wire.Struct(new(Services), "*"), )
ServiceSet is the single, central provider set for the whole backend. Every service constructor (or the wrapper it requires) is listed here exactly once; wire derives the construction order from the dependency graph, so ordering is no longer maintained by hand. wire.Struct assembles the aggregate Services.
Functions ¶
This section is empty.
Types ¶
type Jobs ¶
type Jobs struct {
AutoUpdate *scheduler.AutoUpdateJob
ImageUpdateWatcher *scheduler.ImageUpdateWatcher
DockerClientRefresh *scheduler.DockerClientRefreshJob
Analytics *scheduler.AnalyticsJob
EventCleanup *scheduler.EventCleanupJob
PruningVolumeHelper *scheduler.PruningVolumeHelperJob
ExpiredSessionsCleanup *scheduler.ExpiredSessionsCleanupJob
ScheduledPrune *scheduler.ScheduledPruneJob
FilesystemWatcher *scheduler.FilesystemWatcherJob
VulnerabilityScan *scheduler.VulnerabilityScanJob
AutoHeal *scheduler.AutoHealJob
}
Jobs aggregates every scheduler job. wire populates it via wire.Struct; the bootstrap then registers the constructed jobs with the scheduler and wires the settings-change callbacks — those are post-construction concerns wire does not handle.
type Services ¶
type Services struct {
AppImages *services.ApplicationImagesService
User *services.UserService
Project *services.ProjectService
Environment *services.EnvironmentService
Settings *services.SettingsService
KV *services.KVService
JobSchedule *services.JobService
SettingsSearch *services.SettingsSearchService
CustomizeSearch *services.CustomizeSearchService
Container *services.ContainerService
Image *services.ImageService
Build *services.BuildService
BuildWorkspace *services.BuildWorkspaceService
Lifecycle *services.LifecycleService
Volume *services.VolumeService
Network *services.NetworkService
Port *services.PortService
Swarm *services.SwarmService
ImageUpdate *services.ImageUpdateService
Session *services.SessionService
Auth *services.AuthService
Oidc *services.OidcService
Docker *services.DockerClientService
Template *services.TemplateService
ContainerRegistry *services.ContainerRegistryService
System *services.SystemService
SystemUpgrade *services.SystemUpgradeService
Diagnostics *services.DiagnosticsService
Updater *services.UpdaterService
Event *services.EventService
Activity *services.ActivityService
Version *services.VersionService
Notification *services.NotificationService
ApiKey *services.ApiKeyService
Federated *services.FederatedCredentialService
GitRepository *services.GitRepositoryService
GitOpsSync *services.GitOpsSyncService
Webhook *services.WebhookService
Vulnerability *services.VulnerabilityService
Dashboard *services.DashboardService
Role *services.RoleService
Variable *services.VariableService
// AuthMiddleware is the shared Echo auth middleware. It's wired here so the
// router consumes it from the container instead of building the chain inline.
AuthMiddleware *middleware.AuthMiddleware
}
Services is the single aggregate of every constructed service. wire populates every field via wire.Struct(new(Services), "*"); it is the only service container in the backend (handlers, jobs, and the router all read from it).
func InitializeServices ¶
func InitializeServices(ctx context.Context, db *database.DB, cfg *config.Config, httpClient *http.Client) (*Services, error)
InitializeServices builds the full service graph. ctx, db, cfg, and httpClient are graph inputs supplied by the caller; every other value is constructed by ServiceSet. The generated implementation lives in wire_gen.go.
func (*Services) DockerClient ¶
func (s *Services) DockerClient() *services.DockerClientService
DockerClient returns the Docker client service. Bootstrap needs the docker service on its own (for Close and startup state) before the rest of the container is consumed; this avoids a second return value from the injector.