conf

package
v5.0.9 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoFile = errors.New("no config file provided")

ErrNoFile is the error to return when an empty config file si passed

Functions

func InitAdvancedOptions

func InitAdvancedOptions(proxy bool) *conf.AdvancedConfig

InitAdvancedOptions initializes an advanced config with default values + overriden urls.

func PopulateConfigFromFile

func PopulateConfigFromFile(path string, target interface{}) error

PopulateConfigFromFile parses a json config file and populates the config struct passed as an argument

func PopulateDefaults

func PopulateDefaults(target interface{}) error

PopulateDefaults iterates the passed structure and populates the fields with the value defined in the `s-def` tag

func PopulateFromArguments

func PopulateFromArguments(target interface{}, argMap ArgMap)

PopulateFromArguments examines target fields by reflection and populates them with the contents of argMap

func WriteDefaultConfigFile

func WriteDefaultConfigFile(name string, definition interface{}) error

WriteDefaultConfigFile writes the default config defition to a JSON file

Types

type Admin

type Admin struct {
	Host     string `json:"host" s-cli:"admin-host" s-def:"0.0.0.0" s-desc:"Host where the admin server will listen"`
	Port     int64  `json:"port" s-cli:"admin-port" s-def:"3010" s-desc:"Admin port where incoming connections will be accepted"`
	Username string `json:"username" s-cli:"admin-username" s-def:"" s-desc:"HTTP basic auth username for admin endpoints"`
	Password string `json:"password" s-cli:"admin-password" s-def:"" s-desc:"HTTP basic auth password for admin endpoints"`
	SecureHC bool   `json:"secureChecks" s-cli:"admin-secure-hc" s-def:"false" s-desc:"Secure Healthcheck endpoints as well."`
}

Admin configuration options

type ArgMap

type ArgMap map[string]interface{}

ArgMap is a type alias used to hold values parsed from CLI arguments, used to populate a config structure

func MakeCliArgMapFor

func MakeCliArgMapFor(source interface{}) ArgMap

MakeCliArgMapFor returns a list of cli parameter struct

type CliFlags

type CliFlags struct {
	ConfigFile             *string
	WriteDefaultConfigFile *string
	VersionInfo            *bool
	RawConfig              ArgMap
}

CliFlags defines the basic set of flags that are independent on the binary being executed & config required

func ParseCliArgs

func ParseCliArgs(definition interface{}) *CliFlags

ParseCliArgs accepts a config options struct, parses it's definition (types + metadata) and builds the appropriate flag definitions. It then parses the flags, and returns the structure filled with argument values

type ImpressionListener

type ImpressionListener struct {
	Endpoint  string `json:"endpoint" s-cli:"impression-listener-endpoint" s-def:"" s-desc:"HTTP endpoint to forward impressions to"`
	QueueSize int64  `json:"queueSize" s-cli:"impression-listener-queue-size" s-def:"100" s-desc:"max number of impressions bulks to queue"`
}

ImpressionListener configuration options

type Integrations

type Integrations struct {
	ImpressionListener ImpressionListener `json:"impressionListener" s-nested:"true"`
	Slack              Slack              `json:"slack" s-nested:"true"`
}

Integrations configuration options

type Logging

type Logging struct {
	Level             string `json:"level" s-cli:"log-level" s-def:"info" s-desc:"Log level (error|warning|info|debug|verbose)"`
	Output            string `json:"output" s-cli:"log-output" s-def:"stdout" s-desc:"Where to output logs (defaults to stdout)"`
	RotationMaxFiles  int64  `json:"rotationMaxFiles" s-cli:"log-rotation-max-files" s-def:"10" s-desc:"Max number of files to keep when rotating logs"`
	RotationMaxSizeKb int64  `json:"rotationMaxSizeKb" s-cli:"log-rotation-max-size-kb" s-def:"1024" s-desc:"Maximum log file size in kbs"`
}

Logging configuration options

type Slack

type Slack struct {
	Webhook string `json:"webhook" s-cli:"slack-webhook" s-def:"" s-desc:"slack webhook to post log messages"`
	Channel string `json:"channel" s-cli:"slack-channel" s-def:"" s-desc:"slack channel to post log messages"`
}

Slack configuration options

Jump to

Keyboard shortcuts

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