server

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2026 License: GPL-3.0 Imports: 42 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	Server     *Server
	Scheduler  *scheduler.Scheduler
	DB         *ent.Client
	Store      db.Store
	Auth       auth.Manager
	Downloads  download.Downloader
	Importer   *importer.Worker
	HTTPLogger *observability.HTTPLogger
	Torrents   *bittorrent.Engine
}

App holds the assembled application components. The caller is responsible for starting the scheduler and HTTP server, and for closing the database when done.

func NewFromConfig

func NewFromConfig(ctx context.Context) (*App, error)

NewFromConfig wires all application dependencies from the config singleton. Logging uses the process-wide slog.Default installed by cmd/main.go after observability.Setup, so no logger is plumbed through component constructors.

type Config

type Config struct {
	DB              db.Store
	Ent             *ent.Client
	Movies          movie.Manager
	Metadata        metadata.Provider
	Indexers        indexer.Manager
	Downloads       download.Downloader
	MediaServers    mediaserver.Manager
	DeepLinker      *mediaserver.DeepLinker
	Renamer         library.Renamer
	SeriesRenamer   library.Renamer
	Auth            auth.Manager
	Limiter         auth.Limiter
	OIDC            auth.OIDCManager
	Scheduler       scheduler.Controller
	BulkImports     bulkimport.Manager
	MissingSearcher *rss.MissingSearcher
	TVShows         tvshow.Manager
	Requests        request.Manager
	TVSearcher      *rss.EpisodeMissingSearcher
	MetadataTV      metadata.TVProvider
	Posters         posters.Manager
	Torrents        bittorrent.Manager
	AuthMiddleware  func(http.Handler) http.Handler
	HTTPLog         func(http.Handler) http.Handler
}

Config carries the service-layer dependencies the composition root needs to build the web + restapi handlers and apply auth middleware.

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server is the composition root: chi.Mux wired with auth + observability middleware, mounted with the web.Handler and restapi.Server. The exported Router method returns the fully-wrapped HTTP handler ready to serve.

func New

func New(cfg Config) *Server

New assembles the composition root.

func (*Server) Router

func (s *Server) Router() http.Handler

Router returns the fully-wrapped HTTP handler. otelhttp is applied outermost so every request — including those rejected by chi's 404/405 handlers and those that panic before chi routes them — produces a span.

Directories

Path Synopsis
Package restapi provides primitives to interact with the openapi HTTP API.
Package restapi provides primitives to interact with the openapi HTTP API.
Package web hosts the non-SPA HTTP surface: the SPA shell, the API docs shell, JSON auth endpoints (login / register / logout / config), and the OIDC redirect dance.
Package web hosts the non-SPA HTTP surface: the SPA shell, the API docs shell, JSON auth endpoints (login / register / logout / config), and the OIDC redirect dance.

Jump to

Keyboard shortcuts

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