adminapp

package
v0.0.0-...-a838207 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2026 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotStarted          = errors.New("adminapp: app has not started")
	ErrAlreadyStarted      = errors.New("adminapp: app already started")
	ErrMissingSystemModule = errors.New("adminapp: system module is required")
	ErrNilContext          = errors.New("adminapp: context is nil")
	ErrShutdownTimeout     = errors.New("adminapp: shutdown timed out")
)

Functions

func ApplyServerTimeouts

func ApplyServerTimeouts(server *http.Server)

ApplyServerTimeouts fills in the framework's connection timeouts on server. Timeouts the application already set are kept. Applications that build their own http.Server should call it too.

Types

type App

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

App is a validated, runnable application.

func New

func New(options Options) (*App, error)

New copies and validates configuration and module declarations. It does not open a database, call Create, or listen.

func (*App) ListenerAddr

func (a *App) ListenerAddr() string

ListenerAddr returns the bound address after Run has started listening.

func (*App) Run

func (a *App) Run(ctx context.Context) error

Run starts the default HTTP server and closes the application when it stops.

func (*App) Shutdown

func (a *App) Shutdown(ctx context.Context) error

Shutdown requests a single cleanup. Callers may wait with their own deadline while the application timeout still governs the actual cleanup.

func (*App) Start

func (a *App) Start(ctx context.Context) (http.Handler, error)

Start initializes the modules and returns their HTTP handler. The caller owns the HTTP server and calls Shutdown after requests have drained.

type Options

type Options struct {
	Config             adminconfig.Config
	Modules            []module.Definition
	DB                 *gorm.DB
	Logger             *slog.Logger
	AllowedHTTPMethods []string
}

Options creates a public application. DB, when non-nil, is borrowed.

Jump to

Keyboard shortcuts

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