server

package
v0.0.0-...-86ef13d Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// RecommendedHomeDir defines the default directory used to place all iam service configurations.
	RecommendedHomeDir = ".cp"

	// RecommendedEnvPrefix defines the ENV prefix used by all iam service.
	RecommendedEnvPrefix = "CP"
)

Variables

This section is empty.

Functions

func LoadConfig

func LoadConfig(cfg string, defaultName string)

LoadConfig reads in config file and ENV variables if set.

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 CompletedConfig

type CompletedConfig struct {
	*Config
}

CompletedConfig is the completed configuration for GenericApiServer.

func (CompletedConfig) New

New returns a new instance of GenericApiServer from the given config.

type Config

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

Config is a structure used to configure a GenericApiServer. Its members are sorted roughly in order of importance for composers.

func NewConfig

func NewConfig() *Config

NewConfig returns a Config struct with the default values.

func (*Config) Complete

func (c *Config) Complete() CompletedConfig

Complete fills in any fields not set that are required to have valid data and can be derived from other fields. If you're going to `ApplyOptions`, do that first. It's mutating the receiver.

type GenericApiServer

type GenericApiServer struct {

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

	// InsecureServingInfo holds configuration of the insecure HTTP server.
	InsecureServingInfo *InsecureServingInfo

	// ShutdownTimeout is the timeout used for server shutdown. This specifies the timeout before server
	// gracefully shutdown returns.
	ShutdownTimeout time.Duration

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

GenericApiServer contains state for an iam api server. type GenericApiServer gin.Engine.

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 generic 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()

Setup do some setup work for gin engine.

type InsecureServingInfo

type InsecureServingInfo struct {
	Address string
}

InsecureServingInfo holds configuration of the insecure http server.

type SecureServingInfo

type SecureServingInfo struct {
	BindAddress string
	BindPort    int
	CertKey     CertKey
}

SecureServingInfo holds configuration of the TLS server.

func (*SecureServingInfo) Address

func (s *SecureServingInfo) Address() string

Address join host IP address and host port number into an address string, like: 0.0.0.0:8443.

Jump to

Keyboard shortcuts

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