Documentation

Overview

    Package serverenv defines common parameters for the sever environment.

    Index

    Constants

    This section is empty.

    Variables

    This section is empty.

    Functions

    This section is empty.

    Types

    type ExporterFunc

    type ExporterFunc func(context.Context) metrics.Exporter

      ExporterFunc defines a factory function for creating a context aware metrics exporter.

      type Option

      type Option func(*ServerEnv) *ServerEnv

        Option defines function types to modify the ServerEnv on creation.

        func WithAuthorizedAppProvider

        func WithAuthorizedAppProvider(p authorizedapp.Provider) Option

          WithAuthorizedAppProvider installs a provider for an authorized app.

          func WithBlobStorage

          func WithBlobStorage(sto storage.Blobstore) Option

            WithBlobStorage creates an Option to install a specific Blob storage system.

            func WithDatabase

            func WithDatabase(db *database.DB) Option

              WithDatabase attached a database to the environment.

              func WithKeyManager

              func WithKeyManager(km keys.KeyManager) Option

                WithKeyManager creates an Option to install a specific KeyManager to use for signing requests.

                func WithMetricsExporter

                func WithMetricsExporter(f metrics.ExporterFromContext) Option

                  WithMetricsExporter creates an Option to install a different metrics exporter.

                  func WithObservabilityExporter

                  func WithObservabilityExporter(oe observability.Exporter) Option

                    WithObservabilityExporter creates an Option to install a specific observability exporter system.

                    func WithSecretManager

                    func WithSecretManager(sm secrets.SecretManager) Option

                      WithSecretManager creates an Option to install a specific secret manager to use.

                      type ServerEnv

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

                        ServerEnv represents latent environment configuration for servers in this application.

                        func New

                        func New(ctx context.Context, opts ...Option) *ServerEnv

                          New creates a new ServerEnv with the requested options.

                          func (*ServerEnv) AuthorizedAppProvider

                          func (s *ServerEnv) AuthorizedAppProvider() authorizedapp.Provider

                          func (*ServerEnv) Blobstore

                          func (s *ServerEnv) Blobstore() storage.Blobstore

                          func (*ServerEnv) Close

                          func (s *ServerEnv) Close(ctx context.Context) error

                            Close shuts down the server env, closing database connections, etc.

                            func (*ServerEnv) Database

                            func (s *ServerEnv) Database() *database.DB

                            func (*ServerEnv) GetKeyManager

                            func (s *ServerEnv) GetKeyManager() keys.KeyManager

                            func (*ServerEnv) GetSignerForKey

                            func (s *ServerEnv) GetSignerForKey(ctx context.Context, keyName string) (crypto.Signer, error)

                              GetSignerForKey returns the crypto.Singer implementation to use based on the installed KeyManager. If there is no KeyManager installed, this returns an error.

                              func (*ServerEnv) KeyManager

                              func (s *ServerEnv) KeyManager() keys.KeyManager

                              func (*ServerEnv) MetricsExporter

                              func (s *ServerEnv) MetricsExporter(ctx context.Context) metrics.Exporter

                                MetricsExporter returns a context appropriate metrics exporter.

                                func (*ServerEnv) ObservabilityExporter

                                func (s *ServerEnv) ObservabilityExporter() observability.Exporter

                                func (*ServerEnv) SecretManager

                                func (s *ServerEnv) SecretManager() secrets.SecretManager

                                Source Files