Documentation
¶
Overview ¶
Package serveropts contains an echo server options wrapper
Index ¶
- Variables
- func BackfillDirectoryDuplicates(ctx context.Context, dbClient *ent.Client)
- func ConfigureGala(galaApp, notificationGala *gala.Gala, dbClient *ent.Client, ...) error
- func NewGalaRuntimes(ctx context.Context, so *ServerOptions) (*gala.Gala, *gala.Gala, error)
- func StartGalaWorkers(ctx context.Context, galaApp *gala.Gala) error
- type ServerOption
- func WithAuth() ServerOption
- func WithBackfill(ctx context.Context, galaApp *gala.Gala) ServerOption
- func WithCORS() ServerOption
- func WithCSRF() ServerOption
- func WithCacheHeaders() ServerOption
- func WithCloudflareConfig() ServerOption
- func WithConfigProvider(cfgProvider config.Provider) ServerOption
- func WithDefaultTrustCenterDomain() ServerOption
- func WithEntitlements() ServerOption
- func WithGeneratedKeys() ServerOption
- func WithGraphRateLimiter() ServerOption
- func WithGraphRoute(srv *server.Server, c *ent.Client) ServerOption
- func WithHTTPS() ServerOption
- func WithHistoryGraphRoute(srv *server.Server, c *historygenerated.Client) ServerOption
- func WithIntegrationsRuntime(ctx context.Context, dbClient *ent.Client, galaInstance *gala.Gala) ServerOption
- func WithKeyDirConfig() ServerOption
- func WithKeyDirKeyWatcher(rc *redis.Client) ServerOption
- func WithKeyDirWatcher(dir string, base tokens.Config, archive keyArchive) ServerOption
- func WithMiddleware() ServerOption
- func WithOTP() ServerOption
- func WithObjectStorage() ServerOption
- func WithRateLimiter() ServerOption
- func WithReadyChecks(c *entx.EntClientConfig, f *fgax.Client, r *redis.Client, ...) ServerOption
- func WithSecureMW() ServerOption
- func WithSessionManager(rc *redis.Client) ServerOption
- func WithSessionMiddleware() ServerOption
- func WithShortlinks() ServerOption
- func WithSummarizer() ServerOption
- func WithSupportAccessConfig() ServerOption
- func WithTokenManager() ServerOption
- func WithWorkflows(wf *engine.WorkflowEngine) ServerOption
- type ServerOptions
Constants ¶
This section is empty.
Variables ¶
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
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 ¶
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 ¶
NewGalaRuntimes creates the main and notification gala runtimes from configuration. It does not wire the runtimes to the database client; call ConfigureGala for that.
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 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 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 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 ¶
func WithReadyChecks(c *entx.EntClientConfig, f *fgax.Client, r *redis.Client, j riverqueue.JobClient) ServerOption
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 ¶
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