config

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: May 29, 2021 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
	AuthPort
	AuthPortInt
	AuthMetricsPort
	AuthGRPCGWPort
)

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"`
	AuthAddrHost           appcfg.NotEmptyString `env:"AUTH_ADDR_HOST"`
	AuthAddrHostInt        appcfg.NotEmptyString `env:"AUTH_ADDR_HOST_INT"`
	AuthAddrPort           appcfg.Port           `env:"AUTH_ADDR_PORT"`
	AuthAddrPortInt        appcfg.Port           `env:"AUTH_ADDR_PORT_INT"`
	AuthGRPCGWAddrPort     appcfg.Port           `env:"AUTH_GRPCGW_ADDR_PORT"`
	AuthMetricsAddrPort    appcfg.Port           `env:"AUTH_METRICS_ADDR_PORT"`
	ExampleAddrPort        appcfg.Port           `env:"EXAMPLE_ADDR_PORT"`
	ExampleMetricsAddrPort appcfg.Port           `env:"EXAMPLE_METRICS_ADDR_PORT"`
	TLSCACert              appcfg.NotEmptyString `env:"TLS_CA_CERT"`
	XMySQLAddrHost         appcfg.NotEmptyString `env:"X_MYSQL_ADDR_HOST"`
	XMySQLAddrPort         appcfg.Port           `env:"X_MYSQL_ADDR_PORT"`
	XNATSAddrUrls          appcfg.NotEmptyString `env:"X_NATS_ADDR_URLS"`
	XPostgresAddrHost      appcfg.NotEmptyString `env:"X_POSTGRES_ADDR_HOST"`
	XPostgresAddrPort      appcfg.Port           `env:"X_POSTGRES_ADDR_PORT"`
	XPostgresDBName        appcfg.NotEmptyString `env:"X_POSTGRES_DB_NAME"`
	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