cli

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2019 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateLogger

func CreateLogger(level string, w io.Writer) zerolog.Logger

CreateLogger returns a configured logger.

func RunServer

func RunServer(srv *server.Server, addr string) error

RunServer runs the server and listens to SIGINT and SIGTERM to stop the server gracefully.

Types

type Config

type Config struct {
	Etcd struct {
		Endpoints []string `config:"etcd-endpoints"`
		Namespace string   `config:"etcd-namespace"`
	}
	Server struct {
		Address      string        `config:"addr"`
		Timeout      time.Duration `config:"server-timeout"`
		WatchTimeout time.Duration `config:"server-watch-timeout"`
	}
	LogLevel string `config:"log-level"`
}

Config holds the server configuration.

func LoadConfig

func LoadConfig(args []string) (*Config, error)

LoadConfig loads the configuration from the environment or command line flags. The args hold the command line arguments, as found in os.Argv. It returns flag.ErrHelp if the -help flag is specified on the command line.

Jump to

Keyboard shortcuts

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