bootstrap

package
v0.0.0-...-7f16e2a Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeConfig

func DecodeConfig(data []byte, cfg interface{}) error

DecodeConfig loads config from yaml bytes

func DecodeConfigFile

func DecodeConfigFile(path string, cfg interface{}) error

DecodeConfigFile loads config from yaml file

func RunForConfig

func RunForConfig(ctx context.Context, cfg Config, init func(*InitData) error) error

RunForConfig starts the server for already set config

func RunForPath

func RunForPath(ctx context.Context, path string, cfg Config, init func(*InitData) error) error

RunForPath starts the server, loading config from given path

func Signals

func Signals(ctx context.Context, signals ...os.Signal) context.Context

Signals returns context, waiting for for signal

Types

type ClientConfig

type ClientConfig struct {
	Address  string `yaml:"address"`
	Insecure bool   `yaml:"insecure"`
	Secret   string `yaml:"secret"`
}

func (*ClientConfig) Dial

func (cfg *ClientConfig) Dial(opts ...grpc.DialOption) (*grpc.ClientConn, error)

type Config

type Config interface {
	GetNetwork() string
	GetAddress() string
	IsLoggerEnabled() bool
	GetSecret() string
	GetSecretWhitelist() []string
}

type ConfigStruct

type ConfigStruct struct {
	Network         string   `yaml:"network"`
	Address         string   `yaml:"address"`
	LoggerEnabled   bool     `yaml:"logger-enabled"`
	Secret          string   `yaml:"secret"`
	SecretWhitelist []string `yaml:"secret-whitelist"`
}

func (*ConfigStruct) GetAddress

func (cfg *ConfigStruct) GetAddress() string

func (*ConfigStruct) GetNetwork

func (cfg *ConfigStruct) GetNetwork() string

func (*ConfigStruct) GetSecret

func (cfg *ConfigStruct) GetSecret() string

func (*ConfigStruct) GetSecretWhitelist

func (cfg *ConfigStruct) GetSecretWhitelist() []string

func (*ConfigStruct) IsLoggerEnabled

func (cfg *ConfigStruct) IsLoggerEnabled() bool

type InitData

type InitData struct {
	Logger   *zap.Logger
	Server   *grpc.Server
	Listener net.Listener
}

type TestServer

type TestServer struct {
	// contains filtered or unexported fields
}

func StartTestServer

func StartTestServer(ctx context.Context, init func(d *InitData) error) *TestServer

func (*TestServer) GetDialer

func (s *TestServer) GetDialer() *ClientConfig

func (*TestServer) Stop

func (s *TestServer) Stop() error

Jump to

Keyboard shortcuts

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