config

package
v0.0.0-...-9192568 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithEnv

func WithEnv() func(*ClientConfig)

func WithFile

func WithFile() func(cfg *ClientConfig)

Types

type ClientConfig

type ClientConfig struct {
	File string `env:"CLIENT_CONFIG_FILE" envDefault:"client.yml"`
	API  struct {
		Host   string `json:"host" yaml:"host" env:"API_HOST"`
		Port   int    `json:"port" yaml:"port" env:"API_PORT" envDefault:"8081"`
		Route  string `json:"route" yaml:"route" env:"API_ROUTE" envDefault:"/api/v1"`
		Secure bool   `json:"secure" yaml:"secure" env:"CLIENT_SECURE"`
	} `json:"api" yaml:"api"`
	Cert struct {
		CA   string `json:"ca" yaml:"ca" env:"CA_PATH"`
		Cert string `json:"cert" yaml:"cert" env:"CLIENT_CERT_PATH"`
		Key  string `json:"key" yaml:"key" env:"CLIENT_KEY_PATH"`
	} `json:"cert" yaml:"cert"`
}

func New

func New(opts ...func(*ClientConfig)) *ClientConfig

func (*ClientConfig) GetAPIAddress

func (c *ClientConfig) GetAPIAddress() string

func (*ClientConfig) GetCACertPool

func (c *ClientConfig) GetCACertPool() (*x509.CertPool, error)

func (*ClientConfig) GetCertificate

func (c *ClientConfig) GetCertificate() (tls.Certificate, error)

Jump to

Keyboard shortcuts

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