server

package
v0.0.0-...-c25ae0e Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 46 Imported by: 0

Documentation

Overview

Package server is for setting up the server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleLocalOrOktaWebSocketAuth

func HandleLocalOrOktaWebSocketAuth(omf *okta.MiddlewareFactory) transport.WebsocketInitFunc

HandleLocalOrOktaWebSocketAuth is a function that effectively acts as a wrapper around 2 functions that can serve as a transport.WebSocket "InitFunc" This function looks at the initial payload sent when authenticating a websocket connection, and chooses the appropriate authentication middleware to use (in the case of Authorization headers beginning with "Local", it will use package "local"s local.NewLocalWebSocketAuthenticationMiddleware, and in any other case will use package "okta"s NewOktaWebSocketAuthenticationMiddleware)

This function requires the OktaMiddlewareFactory object because it, in some cases (as described above), needs to perform operations that decode JWTs, which is a responsibility of some of the functions attached to that factory. A refactor to clean up this cross-package dependency was considered but determined to be too much effort. (Don't hurt me)

func NewGQLResponseMiddleware

func NewGQLResponseMiddleware() graphql.ResponseMiddleware

NewGQLResponseMiddleware returns a handler with a request based logger

func NewLoggerMiddleware

func NewLoggerMiddleware(logger *zap.Logger, environment appconfig.Environment) func(http.Handler) http.Handler

NewLoggerMiddleware returns a handler with a request based logger

func NewTraceMiddleware

func NewTraceMiddleware() func(http.Handler) http.Handler

NewTraceMiddleware returns a handler with a trace ID in context

func TypedErrorList

func TypedErrorList(List *gqlerror.List) []apperrors.ITypedError

TypedErrorList casts a list of gqlErrors to Typed Error, so error code can be extracted.

Types

type LambdaConfig

type LambdaConfig struct {
	Endpoint     string
	FunctionName string
}

LambdaConfig is the config to call a lambda func

type OktaClientConfig

type OktaClientConfig struct {
	OktaClientID string
	OktaIssuer   string
}

OktaClientConfig is the okta client configuration

type Server

type Server struct {
	Config *viper.Viper

	Worker *worker.Worker
	// contains filtered or unexported fields
}

Server holds dependencies for running the MINT server

func NewServer

func NewServer(config *viper.Viper) *Server

NewServer sets up the dependencies for a server

func (Server) NewDBConfig

func (s Server) NewDBConfig() storage.DBConfig

NewDBConfig returns a new DBConfig and check required fields

func (Server) NewFlagConfig

func (s Server) NewFlagConfig() flags.Config

NewFlagConfig checks if Launch Darkly config exists

func (Server) NewLocalAuthIsEnabled

func (s Server) NewLocalAuthIsEnabled() bool

NewLocalAuthIsEnabled returns if local auth is enabled

func (Server) NewOktaAPIClientCheck

func (s Server) NewOktaAPIClientCheck()

NewOktaAPIClientCheck checks if the Okta API client is configured

func (Server) NewOktaClientConfig

func (s Server) NewOktaClientConfig() OktaClientConfig

NewOktaClientConfig returns the okta client config

func (Server) NewPrinceLambdaConfig

func (s Server) NewPrinceLambdaConfig() LambdaConfig

NewPrinceLambdaConfig returns the configutation for the prince lambda

func (Server) NewS3Config

func (s Server) NewS3Config() upload.Config

NewS3Config returns a new s3.Config and checks required fields

func (*Server) Serve

func (s *Server) Serve()

Serve runs the server

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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