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: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithEnv

func WithEnv() func(*ServerConfig)

func WithFile

func WithFile() func(cfg *ServerConfig)

Types

type ServerConfig

type ServerConfig struct {
	File   string `env:"SERVER_CONFIG_FILE" envDefault:"server.yml"`
	Server struct {
		Host   string `json:"host" yaml:"host" env:"SERVER_HOST"`
		Port   int    `json:"port" yaml:"port" env:"SERVER_PORT" envDefault:"8081"`
		Secure bool   `json:"secure" yaml:"secure" env:"SERVER_SECURE"`
	} `json:"server" yaml:"server"`
	Database struct {
		Host     string `json:"host" yaml:"host" env:"DB_HOST"`
		Port     int    `json:"port" yaml:"port" env:"DB_PORT"`
		Name     string `json:"name" yaml:"name" env:"DB_NAME"`
		User     string `json:"user" yaml:"user" env:"DB_USER"`
		Password string `json:"password" yaml:"password" env:"DB_PASSWORD"`
	} `json:"database" yaml:"database"`
	Cert struct {
		CA   string `json:"ca" yaml:"ca" env:"CA_PATH"`
		Cert string `json:"cert" yaml:"cert" env:"SERVER_CERT_PATH"`
		Key  string `json:"key" yaml:"key" env:"SERVER_KEY_PATH"`
	} `json:"cert" yaml:"cert"`
}

func New

func New(opts ...func(*ServerConfig)) *ServerConfig

func (*ServerConfig) GetCACertPool

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

func (*ServerConfig) GetCertificatePaths

func (c *ServerConfig) GetCertificatePaths() []string

func (*ServerConfig) GetRepoURL

func (c *ServerConfig) GetRepoURL() string

func (*ServerConfig) GetServerAddress

func (c *ServerConfig) GetServerAddress() string

func (*ServerConfig) IsServerSecure

func (c *ServerConfig) IsServerSecure() bool

Jump to

Keyboard shortcuts

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