app

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 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 {
	HTTPAddress            string
	GRPCAddress            string
	DatabaseURL            string
	JWTIssuer              string
	JWTPrivateKeyPath      string
	JWTPublicKeyPath       string
	RefreshTokenExpiration time.Duration
	AccessTokenExpiration  time.Duration
	PublicURL              string
	MailmanGRPCAddress     string
	EmailWebhookURL        string
	Environment            string
	EncryptionKey          string
	TrustedProxyMode       bool // Enable IP extraction from X-Forwarded-For when behind reverse proxy
	// ProxySecret, when set, requires a matching X-Proxy-Secret header on every request
	// except the health check, so only traffic through the trusted edge is served.
	ProxySecret        string
	CORSAllowedOrigins []string

	// OAuth provider configuration for individual logins
	GoogleClientID     string
	GoogleClientSecret string
	GoogleIssuerURL    string

	MicrosoftClientID     string
	MicrosoftClientSecret string
	MicrosoftTenantID     string
	MicrosoftIssuerURL    string

	GitHubClientID     string
	GitHubClientSecret string
	GitHubAuthURL      string
	GitHubTokenURL     string
	GitHubAPIBase      string

	TOTPPeriod uint // TOTP time window in seconds (default 30, use smaller value for tests)
}

Config holds the configuration for creating a new server

type Server

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

Server wraps the HTTP and gRPC servers and their dependencies. Held as interfaces so the shutdown ordering is testable without real infrastructure.

func NewServer

func NewServer(ctx context.Context, config *Config) (*Server, error)

NewServer creates a new server instance with all dependencies

func (*Server) Shutdown

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

Shutdown drains both servers before releasing anything they depend on. The order matters: Shutdown and GracefulStop each block until in-flight work returns, and that work is still querying and still sending mail. The deferred closes run even if draining fails, so a timeout cannot leak the pool.

func (*Server) Start

func (s *Server) Start() error

Start begins listening for HTTP and gRPC requests

Jump to

Keyboard shortcuts

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