config

package
v0.0.0-...-6e16fae Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2025 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewValidator

func NewValidator() *validator.Validate

NewValidator returns a new validator with our custom validations already registered.

Types

type ProxyConfig

type ProxyConfig struct {
	AcmHub             string   `validate:"required,alphanumhyphen,lowercase"`
	AuthBaseUrl        string   `validate:"required,url"`
	AuthClientId       string   `validate:"required,alphanumhyphen"`
	AuthClientSecret   string   `validate:"required,ascii"`
	AuthRealm          string   `validate:"required,alphanumhyphen"`
	AuthTlsVerify      bool     `validate:"boolean"`
	ClusterKey         string   `validate:"required,alphanum"`
	CorsAllowedOrigins []string `validate:"dive,url|eq=*"`
	HubKey             string   `validate:"required,alphanum"`
	ProjectKey         string   `validate:"required,alphanum"`
	PrometheusBaseUrl  string   `validate:"required,url,startswith=http:|startswith=https:"`
	PrometheusCaCert   string   `validate:"omitempty,file"`
	PrometheusTlsCert  string   `validate:"omitempty,file"`
	PrometheusTlsKey   string   `validate:"omitempty,file"`
	PrometheusToken    string   `validate:"omitempty,ascii"`
	OpenshiftLocal     bool     `validate:"boolean"`
}

ProxyConfig holds our configuration values and defines our validations for those values.

func BuildFromViper

func BuildFromViper(v ViperInterface) *ProxyConfig

BuildFromViper creates a new ProxyConfig instance from viper configuration values (which may come from the command line or the environment).

func (*ProxyConfig) Validate

func (c *ProxyConfig) Validate() error

Runs a validator against the values contained in a ProxyConfig variable.

type ViperInterface

type ViperInterface interface {
	GetString(key string) string
	GetBool(key string) bool
	GetStringSlice(key string) []string
}

ViperInterface allows us to mock out viper during testing.

Jump to

Keyboard shortcuts

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