config

package
v0.0.0-...-bbd7fc3 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2020 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultAppEnvironment is the
	DefaultAppEnvironment = "development"
)

Variables

This section is empty.

Functions

func Refresh

func Refresh()

Refresh will ugly refresh the sync.Once, don't ever use this for anything other than in a test. If you do use it, DNnate or Antoine will come punch me in the face.

Types

type Config

type Config struct {
	ApplicationEnvironment string `mapstructure:"appEnvironment"`
	ProjID                 string `mapstructure:"projectID"`
	ServiceName            string `mapstructure:"serviceName"`
	LogFormatter           string `mapstructure:"logFormatter"`
	MPrefix                string `mapstructure:"metricsPrefix"`
	TelemetryEnabled       bool   `mapstructure:"telemetryEnabled"`
	ErrorAlertingEnabled   bool   `mapstructure:"errorAlertsEnabled"`
	MetricsEnabled         bool   `mapstructure:"metricsEnabled"`
	TracingEnabled         bool   `mapstructure:"tracingEnabled"`
}

Config stores all service configuration that can be injected via ENV var or falls back to defaults

func Read

func Read() *Config

Read returns an instance of config, initializing it only once ever, handling settings defaults and binding ENV vars to structural config values

func (*Config) MetricsPrefix

func (c *Config) MetricsPrefix() string

func (*Config) Production

func (c *Config) Production() bool

Production checks the presence of the ApplicationEnvironment config setting and returns true if it is set to production

func (*Config) ProjectID

func (c *Config) ProjectID() string

ProjectID masks c.projectID and ensures we ALWAYS return the production project, even if something is mis-configured or unset when setting the projectID from configuration values

Jump to

Keyboard shortcuts

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