server

package
v0.0.0-...-a39f72a Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitGenericAPIServer

func InitGenericAPIServer(c *GenericAPIServer)

func LoadConfig

func LoadConfig(cfg string, defaultName string)

LoadConfig reads in config file and ENV variables if set.

func RequestShutdown

func RequestShutdown() bool

RequestShutdown emulates a received event that is considered as shutdown signal (SIGTERM/SIGINT) This returns whether a handler was notified.

func SetupSignalHandler

func SetupSignalHandler() <-chan struct{}

SetupSignalHandler registered for SIGTERM and SIGINT. A stop channel is returned which is closed on one of these signals. If a second signal is caught, the program is terminated with exit code 1.

Types

type CertKey

type CertKey struct {
	// CertFile is a file containing a PEM-encoded certificate, and possibly the complete certificate chain
	CertFile string
	// KeyFile is a file containing a PEM-encoded private key for the certificate specified by CertFile
	KeyFile string
}

CertKey contains configuration items related to certificate.

type Config

type Config struct {
	InsecureServing *InsecureServingInfo
	SecureServing   *SecureServingInfo
	Jwt             *JwtInfo
	Mode            string
	Middlewares     []string
	Healthz         bool
	EnableProfiling bool
	EnableMetrics   bool
}

func NewConfig

func NewConfig() *Config

func (*Config) New

func (c *Config) New()

New returns a new instance of GenericAPIServer form the given config.

type GenericAPIServer

type GenericAPIServer struct {
	Middlewares []string
	Mode        string
	// InsecureServingInfo holds configuration of the insecure HTTP server.
	InsecureServingInfo *InsecureServingInfo

	// SecureServingInfo holds configutation of the TLS server.
	SecureServingInfo *SecureServingInfo

	ShutdownTimeout time.Duration

	*gin.Engine
	Healthz bool
	// contains filtered or unexported fields
}

GenericAPIServer contains state for a filestore api server. type GenericAPIServer gin.Engin.

func (*GenericAPIServer) Close

func (s *GenericAPIServer) Close()

Close graceful shutdown the api server.

func (*GenericAPIServer) InstallAPIs

func (s *GenericAPIServer) InstallAPIs()

InstallAPIs install generic apis.

func (*GenericAPIServer) InstallMiddlewares

func (s *GenericAPIServer) InstallMiddlewares()

InstallMiddlewares install all middlewares.

func (*GenericAPIServer) Run

func (s *GenericAPIServer) Run() error

Run spawns the http server. It only returns when the port cannot be listened on initially.

func (*GenericAPIServer) Setup

func (s *GenericAPIServer) Setup()

type InsecureServingInfo

type InsecureServingInfo struct {
	Address string
}

InsecureServingInfo holds configuration of the insecure http server.

type JwtInfo

type JwtInfo struct {
	// defaults to "filestore jwt"
	Realm string
	// defaults to empty
	Key string
	// defaults to one hour
	Timeout time.Duration
	// defaults to zero
	MaxRefresh time.Duration
}

type SecureServingInfo

type SecureServingInfo struct {
	BindAddress string
	BindPort    int
	CertKey     CertKey
}

SecureServingInfo holds configuration of the TLS server.

Jump to

Keyboard shortcuts

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