runtime

package
v0.31.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 28, 2026 License: MIT Imports: 43 Imported by: 0

Documentation

Overview

Package runtime is the fx composition root for the notifycat server. It reproduces the legacy internal/app.Wire graph as a single fx.Module: every helper that Wire used to call is a provider here, the startup validation gate is an fx.Invoke that fails App.Start on any failing mapping, and the HTTP server plus the cleanup/digest schedulers are driven by fx.Lifecycle hooks.

The module derives everything from a single config.Config the caller supplies (main does fx.Supply(cfg)); it never calls config.Load itself. As the composition root it is exempt from the inward-only layering rule and may import config, persistence, slack, github, and every domain's application and infrastructure packages.

Index

Constants

This section is empty.

Variables

View Source
var Module = fx.Module("runtime",
	access.Module,
	feed.Module,
	fx.Provide(
		newLogger,
		newHTTPClient,
		buildSlackClient,
		newComposer,
		openAndMigrate,
		persistence.NewPullRequests,
		persistence.NewCodeReviews,
		persistence.NewScheduledNotifications,
		persistence.NewAccessInvites,
		persistence.NewAccessTokens,
		persistence.NewFeedSubscriptions,
		persistence.NewFeedPullRequests,
		persistence.NewFeedDeliveries,
		provideAccessSettings,
		buildProvider,
		provideEntryLister,
		buildRouter,
		buildDispatcher,
		buildWebhookDispatcher,
		buildStartReviewSink,
		buildCleanupScheduler,
		buildDigestScheduler,
		buildScheduledRunner,
		AsAgentAPIRoutes(feedinfra.NewRoutes),
		buildMux,
		buildServer,
		buildAdminServer,
		newRunContext,
	),
	fx.Invoke(startupGate),
	fx.Invoke(cleanFeed),
	fx.Invoke(registerServer),
	fx.Invoke(registerAdminServer),
	fx.Invoke(registerSchedulers),
)

Module is the runtime composition root. Supply a config.Config and it builds the whole graph — logger, mappings provider, migrated database, Slack client, per-PR router, dispatcher, start-review sink, access and feed use cases, HTTP server, optional admin server, and the cleanup and digest schedulers — then runs the startup-validation gate and the feed cleanup, and starts the HTTP server, the admin server on its private port, and the schedulers via lifecycle hooks. A failing startup gate or a bad cron spec fails fx.New, and the database handle closes on App.Stop.

Functions

func AsAgentAPIRoutes added in v0.29.0

func AsAgentAPIRoutes(constructor any) any

AsAgentAPIRoutes annotates a constructor returning []httpx.Route so its routes are served on the public mux behind Bearer token authentication.

Types

type AdminServer added in v0.29.0

type AdminServer struct {
	*http.Server
}

AdminServer is the admin API server on the private admin port.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL