server

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2021 License: MIT Imports: 11 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPServerConfiguration

type HTTPServerConfiguration struct {
	Host               string        `envconfig:"HTTP_HOST" default:""`
	Port               int           `envconfig:"HTTP_PORT" default:"80"`
	RequestTimeout     time.Duration `envconfig:"HTTP_REQUEST_TIMEOUT" default:"30s"`
	UserID             string        `envconfig:"USER_ID" required:"true"`
	CertificateFile    string        `envconfig:"CERTIFICATE_FILE" default:"/etc/tls/tls.crt"`
	CertificateKeyFile string        `envconfig:"CERTIFICATE_KEY_FILE" default:"/etc/tls/tls.key"`
}

HTTPServerConfiguration is a struct that holds all the environment variables required to the HTTP server

func (*HTTPServerConfiguration) LoadFromEnvVars

func (h *HTTPServerConfiguration) LoadFromEnvVars() error

LoadFromEnvVars reads all env vars required for the server package

type Server

type Server struct {
	Router *gin.Engine
	// contains filtered or unexported fields
}

Server defines a struct for server

func NewServer

func NewServer(log logging.Logger, configuration HTTPServerConfiguration) *Server

NewServer initializes a server

func (Server) NamespaceValidation

func (s Server) NamespaceValidation() gin.HandlerFunc

NamespaceValidation checks if namespace is in the query params

func (*Server) Run

func (s *Server) Run(ctx context.Context)

Run when called starts the server

func (*Server) RunSecurely

func (s *Server) RunSecurely(ctx context.Context)

RunSecurely when called starts the https server

Jump to

Keyboard shortcuts

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