Documentation
¶
Overview ¶
Package serveropts contains an echo server options wrapper
Index ¶
- Variables
- func ConfigureGala(ctx context.Context, galaApp, notificationGala *gala.Gala, ...) error
- func NewGalaRuntimes(ctx context.Context, so *ServerOptions) (*gala.Gala, *gala.Gala, error)
- type ServerOption
- func WithAuth() ServerOption
- func WithBackfill(ctx context.Context, dbClient *ent.Client) 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) 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 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 ConfigureGala ¶ added in v1.11.0
func ConfigureGala(ctx context.Context, galaApp, notificationGala *gala.Gala, dbClient *ent.Client, so *ServerOptions) error
ConfigureGala wires the gala runtimes to the database client, registers all listeners, and starts workers. It must be called after the database client is created.
func NewGalaRuntimes ¶ added in v1.11.0
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 ¶ added in v1.26.0
func WithBackfill(ctx context.Context, dbClient *ent.Client) ServerOption
WithBackfill runs a one-time, non-blocking, config-gated, idempotent startup backfills use-cases for this are things a db migration can't easily handle, computed data or fields, or repairs
func WithCSRF ¶ added in v0.16.2
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 ¶ added in v1.5.11
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 ¶ added in v0.20.5
func WithDefaultTrustCenterDomain() ServerOption
WithDefaultTrustCenterDomain sets up the default trust center domain for the server
func WithEntitlements ¶ added in v0.4.1
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 ¶ added in v1.25.2
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 ¶ added in v0.50.0
func WithHistoryGraphRoute(srv *server.Server, c *historygenerated.Client) ServerOption
WithGraphRoute adds the graph handler to the server
func WithIntegrationsRuntime ¶ added in v1.15.0
func WithIntegrationsRuntime(ctx context.Context, dbClient *ent.Client) 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 ¶ added in v1.31.7
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 ¶ added in v1.31.7
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 ¶ added in v0.16.2
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 ¶ added in v0.3.0
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 ¶ added in v1.7.1
func WithShortlinks() ServerOption
WithShortlinks sets up the shortlinks client for URL shortening
func WithSummarizer ¶ added in v0.11.0
func WithSummarizer() ServerOption
WithSummarizer sets up the logic for summarizing long blurbs of texts
func WithSupportAccessConfig ¶ added in v1.26.0
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 ¶ added in v1.4.0
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