config

package
v0.0.0-...-cc7cbc4 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Logger                     logger.Config
	APIPackagesSupport         bool
	Port                       int              `default:"8080"`
	Storage                    []storage.Config `valid:"required"`
	BrokerRelistDurationWindow time.Duration    `valid:"required"`
	// UniqueSelectorLabelKey and UniqueSelectorLabelValue allows unambiguously distinguish AB's pods.
	UniqueSelectorLabelKey   string `valid:"required"`
	UniqueSelectorLabelValue string `valid:"required"`
	Namespace                string `valid:"required"`
	ServiceName              string `valid:"required"`
	Director                 struct {
		Service  director.ServiceConfig
		ProxyURL string
	}
	GatewayBaseURLFormat string `default:"http://%s-gateway"`
}

Config provide application broker configuration Supported tags:

  • json: github.com/ghodss/yaml
  • envconfig: github.com/vrischmann/envconfig
  • default: github.com/mcuadros/go-defaults
  • valid github.com/asaskevich/govalidator

Example of valid tag: `valid:"alphanum,required"` Combining many tags: tags have to be separated by WHITESPACE: `json:"port" default:"8080" valid:"required"`

func Load

func Load(verbose bool) (*Config, error)

Load method has following strategy: 1. Check env variable 'APP_CONFIG_FILE_NAME', if exists load configuration from specified file 2. Read configuration from environment variables (will override configuration from file) 3. Apply defaults 4. Validate

Jump to

Keyboard shortcuts

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