server

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	BaseURL                      string
	GitHubClientID               string
	GitHubClientSecret           string
	PrivKey                      jwk.Key
	Logger                       *slog.Logger
	Store                        store.Store          // nil is allowed; fact tools will return an error
	AuthState                    oidc.AuthStateStore  // if nil, Store is used
	Revocation                   oidc.RevocationStore // if nil, Store is used
	ShutdownTimeout              time.Duration
	RefreshTokenGracePeriod      *time.Duration
	RetiredRefreshTokenRetention *time.Duration
	SentryHandler                func(http.Handler) http.Handler
}

Config holds all parameters needed to construct the server.

type Server

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

Server is the configured HTTP server ready to serve requests.

func New

func New(cfg Config) (*Server, error)

New builds the mux, wires all handlers, and returns a Server.

func (*Server) Handler

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

Handler returns the root HTTP handler. Use this with httptest.NewServer in tests.

func (*Server) Run

func (s *Server) Run(ctx context.Context, l net.Listener) error

Run serves on l until ctx is cancelled, then shuts down gracefully. Sequence: stop accepting → drain requests (shutdownTimeout) → close DB pool.

Jump to

Keyboard shortcuts

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