config

package
v0.0.0-...-17853a9 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TLSAddrPrefix = "tls://"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	DebugLogs bool

	GOPSEnabled bool
	GOPSPort    int

	// Enables CORS headers on http routes
	CORSEnabled bool

	E2ETestMode         bool
	E2ELogFilesBasePath string

	// The address of hubble-relay instance
	RelayAddr string

	// The port which will be used to listen to on grpc server setup
	UIServerPort uint16

	// NOTE: The delays that will be used to calculate the delay the client
	// should use for waiting between two poll requests (custom protocol).
	MinClientPollDelay time.Duration
	MaxClientPollDelay time.Duration

	TLSToRelayEnabled bool
	// The meaning of this flags is the same as in
	// https://github.com/cilium/hubble/blob/master/cmd/common/config/flags.go
	TLSRelayServerName     string
	TLSRelayCACertFiles    []string
	TLSRelayClientCertFile string
	TLSRelayClientKeyFile  string
	// contains filtered or unexported fields
}

func (*Config) AsRelayClientTLSConfig

func (cfg *Config) AsRelayClientTLSConfig() (*tls.Config, error)

func (*Config) UIServerListenAddr

func (cfg *Config) UIServerListenAddr() string

type ConfigBuilder

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

func New

func New(log *logrus.Logger, propGetters PropGetters) *ConfigBuilder

func (*ConfigBuilder) Build

func (b *ConfigBuilder) Build() (*Config, error)

type EnvVarGetter

type EnvVarGetter[T any] func() EnvVarResult[T]

func Bool

func Bool(envName string) EnvVarGetter[bool]

func BoolOr

func BoolOr(envName string, def bool) EnvVarGetter[bool]

func DurationOr

func DurationOr(envName string, def time.Duration) EnvVarGetter[time.Duration]

func Str

func Str(envName string) EnvVarGetter[string]

func StrOr

func StrOr(envName string, def string) EnvVarGetter[string]

func Uint16Or

func Uint16Or(envName string, def uint16) EnvVarGetter[uint16]

type EnvVarResult

type EnvVarResult[T any] struct {
	IsRequired  bool
	IsPresented bool
	VarName     string
	Value       T
	ParseErr    error
}

func (*EnvVarResult[T]) Err

func (er *EnvVarResult[T]) Err() error

func (*EnvVarResult[T]) LogIfFallback

func (er *EnvVarResult[T]) LogIfFallback(log logrus.FieldLogger)

type PropGetters

type PropGetters struct {
	GopsEnabled              EnvVarGetter[bool]
	GopsPort                 EnvVarGetter[uint16]
	CorsEnabled              EnvVarGetter[bool]
	DebugLogs                EnvVarGetter[bool]
	RelayAddr                EnvVarGetter[string]
	UIServerPort             EnvVarGetter[uint16]
	TLSToRelayEnabled        EnvVarGetter[bool]
	TLSToRelayServerName     EnvVarGetter[string]
	TLSToRelayCACertFiles    EnvVarGetter[string]
	TLSToRelayClientCertFile EnvVarGetter[string]
	TLSToRelayClientKeyFile  EnvVarGetter[string]
	ClientPollDelays         []time.Duration
	E2ETestModeEnabled       EnvVarGetter[bool]
	E2ELogfilesBasepath      EnvVarGetter[string]
}

Jump to

Keyboard shortcuts

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