server

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

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

	// RecommendedEnvPrefix defines the ENV prefix used by all generic service.
	RecommendedEnvPrefix = "echoryn"
)

Variables

This section is empty.

Functions

func LoadConfig

func LoadConfig(cfg string, defaultName string, optional bool)

LoadConfig reads in config file and ENV variables if set. When optional is true, missing config files are silently ignored (CLI Tool behaviour, like kubectl). When false, a WARN is emitted (server behaviour)

Types

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 {
	Serving         *ServingInfo
	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

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 GRPCAPIServer

type GRPCAPIServer struct {
	*grpc.Server
	// contains filtered or unexported fields
}

func NewGRPCAPIServer

func NewGRPCAPIServer(srv *grpc.Server, address string) *GRPCAPIServer

func (*GRPCAPIServer) Close

func (s *GRPCAPIServer) Close()

func (*GRPCAPIServer) Run

func (s *GRPCAPIServer) Run()

type GenericAPIServer

type GenericAPIServer struct {

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

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

	*gin.Engine

	Server *http.Server
	// contains filtered or unexported fields
}

GenericAPIServer contains state for a generic 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()

func (*GenericAPIServer) InstallMiddlewares

func (s *GenericAPIServer) InstallMiddlewares()

InstallMiddlewares installs middlewares to gin engine.

func (*GenericAPIServer) Run

func (s *GenericAPIServer) Run() error

func (*GenericAPIServer) Setup

func (s *GenericAPIServer) Setup()

Setup do some setup work for gin engine.

type ServingInfo

type ServingInfo struct {
	BindAddress string
	BindPort    int
}

ServingInfo holds configuration

func (*ServingInfo) Address

func (s *ServingInfo) Address() string

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

Jump to

Keyboard shortcuts

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