config

package
v0.149.0 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2025 License: Apache-2.0 Imports: 12 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BindConfigToFlags added in v0.145.0

func BindConfigToFlags(v *viper.Viper, cmd *cobra.Command, config any) error

func LoadConfigFromContext

func LoadConfigFromContext(ctx context.Context) any

func SetConfigInContext

func SetConfigInContext(ctx context.Context, config any) context.Context

Types

type CommonServiceConfig added in v0.144.0

type CommonServiceConfig struct {
	DebugLabelValue         string `mapstructure:"debug-label-value" description:"Set the debug label value"`
	MaxConcurrentReconciles int    `mapstructure:"max-concurrent-reconciles" default:"10" description:"Set the max concurrent reconciles"`
	Environment             string `mapstructure:"environment"`
	Region                  string `mapstructure:"region" default:"local" description:"Set the region of the service, e.g. local, dev, staging, prod"`
	Kubeconfig              string `mapstructure:"kubeconfig" description:"Set the kubeconfig path"`
	IsLocal                 bool   `mapstructure:"is-local" default:"false" description:"Flagging execution to be local"`

	Image struct {
		Name string `mapstructure:"image-name" description:"Set the image name"`
		Tag  string `mapstructure:"image-tag" description:"Set the image tag"`
	} `mapstructure:",squash"`

	Log struct {
		Level  string `mapstructure:"log-level" default:"info" description:"Set the log level"`
		NoJson bool   `mapstructure:"no-json" default:"false" description:"Disable JSON logging"`
	} `mapstructure:",squash"`

	ShutdownTimeout time.Duration `mapstructure:"shutdown-timeout" default:"1m" description:"Set the shutdown timeout as duration in seconds, e.g. 30s, 1m, 2h"`
	Metrics         struct {
		BindAddress string `mapstructure:"metrics-bind-address" default:":9090" description:"Set the metrics bind address"`
		Secure      bool   `mapstructure:"metrics-secure" default:"false" description:"Set if metrics should be exposed via https"`
	} `mapstructure:",squash"`
	Tracing struct {
		Enabled   bool          `mapstructure:"tracing-enabled" default:"false" description:"Enable tracing for the service"`
		Collector traces.Config `mapstructure:",squash"`
	} `mapstructure:",squash"`
	EnableHTTP2            bool   `mapstructure:"enable-http2" default:"true" description:"Toggle to disable metrics/webhook serving using http2"`
	HealthProbeBindAddress string `mapstructure:"health-probe-bind-address" default:":8090" description:"Set the health probe bind address"`

	LeaderElection struct {
		Enabled bool `mapstructure:"leader-elect" default:"false" description:"Enable leader election for the controller manager"`
	} `mapstructure:",squash"`

	Sentry struct {
		Dsn string `mapstructure:"sentry-dsn" description:"Set the Sentry DSN for error reporting"`
	} `mapstructure:",squash"`
}

func NewDefaultConfig added in v0.145.0

func NewDefaultConfig(rootCmd *cobra.Command) (*viper.Viper, *CommonServiceConfig, error)

Jump to

Keyboard shortcuts

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