config

package
v0.0.0-...-81cdc2d Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FlagEnvConfigLoader

type FlagEnvConfigLoader struct {
	// Source: env/flag
	Source SourceType
	// EnableTLSFlag enables TLS flag
	EnableTLSFlag bool
	// TLSConfig can be overridden in the initial stage of a bean
	TLSConfig
}

FlagEnvConfigLoader provides the function of obtaining config from command flags and environment variables.

func (*FlagEnvConfigLoader) Process

func (c *FlagEnvConfigLoader) Process(conf framework.Config, name string, errs *errorcode.Errs)

Process Configuration Load. The env/envflag type config is obtained from the environment variable, and the value in the envflag type config is processed and replaced according to the priority.

func (*FlagEnvConfigLoader) RegisterFlags

func (c *FlagEnvConfigLoader) RegisterFlags(conf framework.Config, name string, fs *pflag.FlagSet)

RegisterFlags registers flags.

func (*FlagEnvConfigLoader) RegisterTLSFlag

func (c *FlagEnvConfigLoader) RegisterTLSFlag(name string, fs *pflag.FlagSet)

RegisterTLSFlag registers TLS Flag.

type Setter

type Setter interface {
	// Set sets the object with a string value.
	Set(value string) error
}

Setter sets the object with a string value.

type SourceType

type SourceType string
const (
	SourceFlag SourceType = "flag"
	SourceEnv  SourceType = "env"
)

type TLSConfig

type TLSConfig struct {
	EnableTLS      bool
	CAPath         string
	ServerCertPath string
	ServerKeyPath  string
	ClientCertPath string
	ClientKeyPath  string
}

TLSConfig defines tls config info.

func (*TLSConfig) InitTLSConfig

func (c *TLSConfig) InitTLSConfig(enableTLS bool, caPath, serverCertPath, serverKeyPath, clientCertPath, clientKeyPath string)

InitTLSConfig used to init tls config.

func (*TLSConfig) InstallPFlags

func (c *TLSConfig) InstallPFlags(beanName string, fs *pflag.FlagSet)

InstallPFlags used to install pflags.

func (*TLSConfig) LoadServerTLSConfig

func (c *TLSConfig) LoadServerTLSConfig() (*tls.Config, error)

LoadServerTLSConfig loads server tls config.

func (*TLSConfig) TLSEnabled

func (c *TLSConfig) TLSEnabled() bool

TLSEnabled checks if tls is enabled.

type TLSServerConfig

type TLSServerConfig struct {
	ServerCertFile string `yaml:"serverCertFile,omitempty"`
	ServerCertData string `yaml:"serverCertData,omitempty"`
	ServerKeyFile  string `yaml:"serverKeyFile,omitempty"`
	ServerKeyData  string `yaml:"serverKeyData,omitempty"`

	RootCA     *x509.Certificate `yaml:"-"`
	RootCAKey  *rsa.PrivateKey   `yaml:"-"`
	ServerCert *x509.Certificate `yaml:"-"`
	ServerKey  *rsa.PrivateKey   `yaml:"-"`
	CommonName string            `yaml:"-"`
}

func (*TLSServerConfig) GenerateServerKeyCerts

func (t *TLSServerConfig) GenerateServerKeyCerts(commonName string, ipList []string, dnsList []string) error

func (*TLSServerConfig) LoadFromDataOrFile

func (t *TLSServerConfig) LoadFromDataOrFile(ipList, dnsList []string) error

Jump to

Keyboard shortcuts

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