cmd

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Version = "unknown"
	Build   = "unknown"
	Time    = "unknown"
	Packer  = ""
)

Build number and versions injected at compile time.

Functions

func GenerateServerCertEd

func GenerateServerCertEd(c *Conf, log zerolog.Logger, local bool) error

GenerateServerCertEd will generate a new certificate and private key. This function will return an error if a key or a cert already exist as to avoid any data loss.

func NewLogger

func NewLogger(conf *Conf) zerolog.Logger

NewLogger will return a new logger.

func Setup

func Setup(com *cobra.Command)

Setup will setup the cobra command to bind flags and append subcommands.

Types

type Conf

type Conf struct {
	Log      LogConf      `mapstructure:"log"`
	Server   ServerConf   `mapstructure:"server"`
	Database DatabaseConf `mapstructure:"database"`
}

Conf holds the various configuration structures and is used to parse the config file if any.

func NewConf

func NewConf() (*Conf, error)

NewConf will parse and return the configuration.

type DatabaseConf

type DatabaseConf struct {
	Path                string        `mapstructure:"path"`
	MaxBucketsRecursion int           `mapstructure:"max_buckets_recursion"`
	DefaultLockTTL      time.Duration `mapstructure:"default_lock_ttl"`
}

DatabaseConf stores the database configuration.

type LogConf

type LogConf struct {
	Level  string `mapstructure:"level"`
	Type   string `mapstructure:"type"`
	Caller bool   `mapstructure:"caller"`
}

LogConf represents the logger configuration.

type ServerConf

type ServerConf struct {
	Host string    `mapstructure:"host"`
	Port int       `mapstructure:"port"`
	TLS  TLSConfig `mapstructure:"tls"`
}

ServerConf represents the server configuration.

func (ServerConf) ListenAddr

func (s ServerConf) ListenAddr() string

ListenAddr returns a formatted string to listen on.

type TLSConfig

type TLSConfig struct {
	CertPath string `mapstructure:"cert_path"`
	KeyPath  string `mapstructure:"key_path"`
	Type     string `mapstructure:"tls"`
}

TLSConfig represents the TLS configuration of the service.

Jump to

Keyboard shortcuts

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