conf

package
v1.18.0 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AddrFamilyIpv6 = "ip6"
	AddrFamilyIpv4 = "ip4"
)

Variables

View Source
var SensitiveFields = []string{"KeyPair"}

Functions

func IsValidUrl

func IsValidUrl(input string) bool

func PrintFields added in v1.12.1

func PrintFields(data any, ignoredKeys ...string)

func ValidateConfig added in v1.12.0

func ValidateConfig[T any](c T) error

Types

type EmailConfig added in v1.11.0

type EmailConfig struct {
	From             string   `yaml:"from" env:"EMAIL_FROM" validate:"required_with=SmtpHost,omitempty,required_without=FromFile"`
	FromFile         string   `yaml:"from_file" env:"EMAIL_FROM_FILE" validate:"required_with=SmtpHost,omitempty,required_without=From"`
	To               []string `yaml:"to"   env:"EMAIL_TO" envSeparator:";" validate:"required_with=SmtpHost,omitempty,required_without=ToFile"`
	ToFile           string   `yaml:"to_file"   env:"EMAIL_TO" validate:"required_with=SmtpHost,omitempty,required_without=To"`
	SmtpHost         string   `yaml:"host" env:"EMAIL_HOST" validate:"omitempty,required"`
	SmtpPort         int      `yaml:"port" env:"EMAIL_PORT" validate:"omitempty,required"`
	SmtpUsername     string   `yaml:"user" env:"EMAIL_USER" validate:"required_with=SmtpHost,omitempty,required_without=SmtpUsernameFile"`
	SmtpUsernameFile string   `yaml:"user_file" env:"EMAIL_USER_FILE" validate:"required_with=SmtpHost,omitempty,required_without=smtpUsername"`
	SmtpPassword     string   `yaml:"password" env:"EMAIL_PASSWORD" validate:"required_with=SmtpHost,omitempty,required_without=SmtpPasswordFile"`
	SmtpPasswordFile string   `yaml:"password_file" env:"EMAIL_PASSWORD_FILE" validate:"required_with=SmtpHost,omitempty,required_without=SmtpPassword"`
}

func (*EmailConfig) GetFrom added in v1.18.0

func (conf *EmailConfig) GetFrom() (string, error)

func (*EmailConfig) GetPassword added in v1.18.0

func (conf *EmailConfig) GetPassword() (string, error)

func (*EmailConfig) GetTo added in v1.18.0

func (conf *EmailConfig) GetTo() ([]string, error)

func (*EmailConfig) GetUsername added in v1.18.0

func (conf *EmailConfig) GetUsername() (string, error)

func (*EmailConfig) IsConfigured added in v1.18.0

func (conf *EmailConfig) IsConfigured() bool

func (*EmailConfig) Validate added in v1.11.0

func (conf *EmailConfig) Validate() error

type HttpConfig added in v1.18.0

type HttpConfig struct {
	ListenAddr string `yaml:"addr" validate:""`
	TlsCert    string `yaml:"tls_cert" validate:"required_with=TlsKey,file"`
	TlsKey     string `yaml:"tls_key" validate:"required_with=TlsCert,file"`
}

type MqttConfig

type MqttConfig struct {
	Brokers        []string `yaml:"brokers" env:"BROKERS" envSeparator:";" validate:"broker"`
	ClientId       string   `yaml:"client_id" env:"CLIENT_ID" validate:"required_with=Brokers ''"`
	CaCertFile     string   `yaml:"tls_ca_cert" env:"TLS_CA" validate:"omitempty,file"`
	ClientCertFile string   `yaml:"tls_client_cert" env:"TLS_CERT" validate:"omitempty,required_unless=ClientKeyFile '',file"`
	ClientKeyFile  string   `yaml:"tls_client_key" env:"TLS_KEY" validate:"omitempty,required_unless=ClientCertFile '',file"`
	TlsInsecure    bool     `yaml:"tls_insecure" env:"TLS_INSECURE"`
}

func (*MqttConfig) TlsConfig added in v1.6.0

func (conf *MqttConfig) TlsConfig() *tls.Config

func (*MqttConfig) UsesTlsClientCerts added in v1.12.1

func (conf *MqttConfig) UsesTlsClientCerts() bool

type VaultAuthStrategy added in v1.14.0

type VaultAuthStrategy string
var (
	VaultAuthStrategyToken      VaultAuthStrategy = "token"
	VaultAuthStrategyApprole    VaultAuthStrategy = "approle"
	VaultAuthStrategyKubernetes VaultAuthStrategy = "kubernetes"
)

type VaultConfig

type VaultConfig struct {
	VaultAddr string `yaml:"vault_addr,omitempty" env:"VAULT_ADDR" validate:"required_unless=AuthStrategy ''"`

	AuthStrategy VaultAuthStrategy `yaml:"vault_auth_strategy" env:"VAULT_AUTH_STRATEGY" validate:"omitempty,oneof=token approle kubernetes"`

	AwsRoleName  string `yaml:"vault_aws_role_name,omitempty" env:"VAULT_AWS_ROLE_NAME"`
	AwsMountPath string `yaml:"vault_aws_mount_path,omitempty" env:"VAULT_AWS_MOUNT"`

	AppRoleId       string `yaml:"vault_app_role_id,omitempty" env:"VAULT_APPROLE_ROLE_ID"`
	AppRoleSecretId string `yaml:"vault_app_role_secret,omitempty" env:"VAULT_APPROLE_SECRET_ID"`

	VaultToken string `yaml:"vault_token,omitempty" env:"VAULT_TOKEN"`
}

func GetDefaultVaultConfig

func GetDefaultVaultConfig() VaultConfig

func (*VaultConfig) UseVaultCredentialsProvider added in v1.14.0

func (c *VaultConfig) UseVaultCredentialsProvider() bool

Jump to

Keyboard shortcuts

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