config

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package config provides configuration shared by microservices.

Default values can be obtained from various sources (constants, environment variables, etc.) and then overridden by flags.

As configuration is global you can get it only once for safety: you can call only one of Get… functions and call it just once.

Index

Constants

View Source
const (
	MonoPort = 17000 + iota
	ExamplePort
	ExampleMetricsPort
)

Default ports.

View Source
const EnvPrefix = "MONO_"

EnvPrefix defines common prefix for environment variables.

Variables

This section is empty.

Functions

This section is empty.

Types

type Shared

type Shared struct {
	AddrHost               appcfg.NotEmptyString `env:"ADDR_HOST"`
	AddrHostInt            appcfg.NotEmptyString `env:"ADDR_HOST_INT"`
	ExampleAddrPort        appcfg.Port           `env:"EXAMPLE_ADDR_PORT"`
	ExampleMetricsAddrPort appcfg.Port           `env:"EXAMPLE_METRICS_ADDR_PORT"`
	XMySQLAddrHost         appcfg.NotEmptyString `env:"X_MYSQL_ADDR_HOST"`
	XMySQLAddrPort         appcfg.Port           `env:"X_MYSQL_ADDR_PORT"`
	XNATSAddrUrls          appcfg.NotEmptyString `env:"X_NATS_ADDR_URLS"`
	XSTANClusterID         appcfg.NotEmptyString `env:"X_STAN_CLUSTER_ID"`
}

Shared contains configurable values shared by microservices.

func Get

func Get() (*Shared, error)

Get updates config defaults (from env) and returns shared config.

Jump to

Keyboard shortcuts

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