serveropts

package
v2.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2026 License: Apache-2.0 Imports: 76 Imported by: 0

Documentation

Overview

Package serveropts contains an echo server options wrapper

Index

Constants

This section is empty.

Variables

View Source
var ErrBackfillRequiresGala = errors.New("backfill enabled without gala runtime: enable workflows.gala or disable backfill")

ErrBackfillRequiresGala is returned when startup backfills are enabled without the gala runtime

View Source
var ErrNoSigningKeys = errors.New("no signing keys found in key directory")

ErrNoSigningKeys is returned when no signing keys are found in the key directory

Functions

func BackfillDirectoryDuplicates

func BackfillDirectoryDuplicates(ctx context.Context, dbClient *ent.Client)

BackfillDirectoryDuplicates removes forked directory rows sharing an (integration_id, external_id) identity: concurrent syncs raced the same record into multiple rows, which the run-scoped unique index permitted, and the ingest lookup fails "not singular" on every subsequent sync until only one row remains. The earliest row survives; the extras and their memberships are deleted rather than repointed, because membership foreign keys are immutable and the next complete directory sync rebuilds active memberships against the survivor

func ConfigureGala

func ConfigureGala(galaApp, notificationGala *gala.Gala, dbClient *ent.Client, wfEngine *engine.WorkflowEngine) error

ConfigureGala wires the gala runtimes to the database client and registers all listeners; it must be called after the database client is created. wfEngine is nil when workflows are disabled

func NewGalaRuntimes

func NewGalaRuntimes(ctx context.Context, so *ServerOptions) (*gala.Gala, *gala.Gala, error)

NewGalaRuntimes creates the main and notification gala runtimes from configuration. It does not wire the runtimes to the database client; call ConfigureGala for that.

func StartGalaWorkers

func StartGalaWorkers(ctx context.Context, galaApp *gala.Gala) error

StartGalaWorkers begins job processing on the durable gala runtime; call it only after all injector provisioning completes so a dequeued job never resolves a missing dependency

Types

type ServerOption

type ServerOption interface {
	// contains filtered or unexported methods
}

func WithAuth

func WithAuth() ServerOption

WithAuth supplies the authn and jwt config for the server

func WithBackfill

func WithBackfill(ctx context.Context, galaApp *gala.Gala) ServerOption

WithBackfill submits the config-gated, idempotent startup backfills as a run-once gala job: every pod submits the same unique key, so exactly one process executes the run. Use-cases are things a db migration can't easily handle, computed data or fields, or repairs

func WithCORS

func WithCORS() ServerOption

WithCORS sets up the CORS middleware for the server

func WithCSRF

func WithCSRF() ServerOption

WithCSRF sets up the CSRF middleware for the server

func WithCacheHeaders

func WithCacheHeaders() ServerOption

WithCacheHeaders sets up the cache control headers for the server

func WithCloudflareConfig

func WithCloudflareConfig() ServerOption

WithCloudflareConfig sets up the Cloudflare configuration for the server

func WithConfigProvider

func WithConfigProvider(cfgProvider config.Provider) ServerOption

WithConfigProvider supplies the config for the server

func WithDefaultTrustCenterDomain

func WithDefaultTrustCenterDomain() ServerOption

WithDefaultTrustCenterDomain sets up the default trust center domain for the server

func WithEntitlements

func WithEntitlements() ServerOption

WithEntitlements sets up the entitlements client for the server which currently only supports stripe

func WithGeneratedKeys

func WithGeneratedKeys() ServerOption

WithGeneratedKeys will generate a public/private key pair that can be used for jwt signing. This should only be used in a development environment

func WithGraphRateLimiter

func WithGraphRateLimiter() ServerOption

WithGraphRateLimiter prepends a dedicated rate limiter to the GraphQL middleware chain so the primary API surface is throttled ahead of authentication and resolver work

func WithGraphRoute

func WithGraphRoute(srv *server.Server, c *ent.Client) ServerOption

WithGraphRoute adds the graph handler to the server

func WithHTTPS

func WithHTTPS() ServerOption

WithHTTPS sets up TLS config settings for the server

func WithHistoryGraphRoute

func WithHistoryGraphRoute(srv *server.Server, c *historygenerated.Client) ServerOption

WithGraphRoute adds the graph handler to the server

func WithIntegrationsRuntime

func WithIntegrationsRuntime(ctx context.Context, dbClient *ent.Client, galaInstance *gala.Gala) ServerOption

WithIntegrationsRuntime builds the integration runtime from server settings and wires it into the handler. When a workflow engine is present it also injects integration dependencies. Initialization is skipped if the database client or Gala runtime is nil.

func WithKeyDirConfig

func WithKeyDirConfig() ServerOption

WithKeyDirConfig loads the keys in the configured key directory into the token config so the token manager can be built from them. It must run before WithTokenManager

func WithKeyDirKeyWatcher

func WithKeyDirKeyWatcher(rc *redis.Client) ServerOption

WithKeyDirKeyWatcher starts the key directory watcher against the running token manager. It must run after WithTokenManager, and after the redis client exists for the archive to outlive a single pod

func WithKeyDirWatcher

func WithKeyDirWatcher(dir string, base tokens.Config, archive keyArchive) ServerOption

WithKeyDirWatcher watches dir and applies key changes to the existing TokenManager. The manager is mutated rather than replaced so consumers holding the pointer, notably the ent client, keep signing and verifying with current keys

func WithMiddleware

func WithMiddleware() ServerOption

WithMiddleware adds the middleware to the server

func WithOTP

func WithOTP() ServerOption

WithOTP sets up the OTP provider

func WithObjectStorage

func WithObjectStorage() ServerOption

WithObjectStorage sets up the object storage for the server

func WithRateLimiter

func WithRateLimiter() ServerOption

WithRateLimiter sets up the global and unmatched-route rate limiters for the server

func WithReadyChecks

WithReadyChecks adds readiness checks to the server

func WithSecureMW

func WithSecureMW() ServerOption

WithSecureMW sets up the secure middleware for the server

func WithSessionManager

func WithSessionManager(rc *redis.Client) ServerOption

WithSessionManager sets up the default session manager with a 10 minute ttl with persistence to redis

func WithSessionMiddleware

func WithSessionMiddleware() ServerOption

WithSessionMiddleware sets up the session middleware for the server

func WithShortlinks() ServerOption

WithShortlinks sets up the shortlinks client for URL shortening

func WithSummarizer

func WithSummarizer() ServerOption

WithSummarizer sets up the logic for summarizing long blurbs of texts

func WithSupportAccessConfig

func WithSupportAccessConfig() ServerOption

WithSupportAccessConfig sets up the Openlane support access configuration for the server

func WithTokenManager

func WithTokenManager() ServerOption

WithTokenManager sets up the token manager for the server

func WithWorkflows

func WithWorkflows(wf *engine.WorkflowEngine) ServerOption

WithWorkflows sets up the workflows engine for the server

type ServerOptions

type ServerOptions struct {
	// ConfigProvider is the provider for the server configuration
	ConfigProvider serverconfig.Provider
	// Config is the server configuration settings
	Config serverconfig.Config
	// contains filtered or unexported fields
}

ServerOptions defines the options for the server

func NewServerOptions

func NewServerOptions(opts []ServerOption, cfgLoc string) *ServerOptions

NewServerOptions creates a new ServerOptions instance with the provided options and configuration location

func (*ServerOptions) AddServerOptions

func (so *ServerOptions) AddServerOptions(opts ...ServerOption)

AddServerOptions applies server options after the initial setup this should be used when information is not available on NewServerOptions

Jump to

Keyboard shortcuts

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