server

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2026 License: MIT Imports: 39 Imported by: 0

Documentation

Overview

Package server wires all services together and starts the HTTP servers. The public listener serves dashboard SPA, dashboard JSON API (/api) and /v1 API with authentication enforced. The optional admin listener serves the same JSON API without authentication and binds loopback only. The server refuses to start while the dashboard password is unset. Route tables live in httpapi and mount on both.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDoctor added in v0.6.1

func NewDoctor(sqliteDatabase *db.Database, logger *slog.Logger) (*doctor.GormService, error)

NewDoctor builds the database doctor without starting a server: no listener, no background job, no startup cleanup. The backend wiring mirrors New, because the missing-backend check depends on every provider adapter being registered; a missing adapter would flag its providers and a fix would disable them.

Types

type Server

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

Server is the fully-wired llm-router application: one public listener plus an optional loopback-only admin listener answering the same JSON API without authentication.

func New

func New(applicationConfig *config.Config, logger *slog.Logger) (*Server, error)

New builds the full Server from config. The SQLite file at DBPath owns durable configuration; the file at CachePath owns rebuildable cache state; the file at EventsPath owns operator telemetry. All start empty on first run; built-in rows seed into the database file.

func (*Server) Close

func (s *Server) Close() error

Close releases the SQLite handles, vacuuming each file after checkpointing its write-ahead log. Call after Run returns.

func (*Server) EventsService added in v0.4.0

func (s *Server) EventsService() *events.Service

EventsService exposes the events service for logger wiring.

func (*Server) Run

func (s *Server) Run(ctx context.Context, onListening func()) error

Run starts the maintenance loop and blocks on the HTTP servers. onListening, when set, runs once after every listener is bound.

Jump to

Keyboard shortcuts

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