server

package
v0.0.0-...-66da7ee Latest Latest
Warning

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

Go to latest
Published: May 12, 2026 License: MIT Imports: 33 Imported by: 0

Documentation

Overview

Package server wires up the HTTP server with all routes.

Package server wires together all ghp components and runs the HTTP server(s). It is responsible for:

  • Opening the database and running/checking migrations
  • Initializing encryption, token services, and the GitHub App provider
  • Building the host-dispatch handler that routes requests by Host header to the appropriate backend (API proxy, github.com passthrough, codeload.github.com redirect/passthrough, Copilot passthrough, or management UI)
  • Starting TLS and/or plain HTTP listeners (including systemd socket activation support)
  • Running the dedicated Prometheus metrics server on a separate port
  • Handling graceful shutdown (SIGINT/SIGTERM) and configuration hot-reload (SIGUSR1)
  • Applying cross-cutting middleware: access logging, security headers, and the Server response header

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

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

API handles the service API endpoints (token management, users).

func NewAPI

func NewAPI(ctx context.Context, cfg *config.Config, store database.Store, ts *token.Service, ah *auth.Handler, enc *crypto.Encryptor, atp *ghpgithub.AppTokenProvider, ar *ghpgithub.AppRegistry, ptr *proxy.ProxyTokenResolver, ur *proxy.UsernameResolver, logger *slog.Logger, aw *auditLogWriter) *API

NewAPI creates a new API handler.

func (*API) RegisterRoutes

func (a *API) RegisterRoutes(mux *http.ServeMux)

RegisterRoutes adds API routes to the given mux. All routes require authentication via the auth handler.

type Server

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

Server is the main ghp server.

func New

func New(cfg *config.Config, configPath string, version string, logger *slog.Logger, logWriter io.Writer, migrate bool) *Server

New creates a new Server.

func (*Server) Run

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

Run starts the server and blocks until shutdown.

Jump to

Keyboard shortcuts

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