config

package
v0.0.1-alpha.7 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package config implements the configuration loader.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewContext

func NewContext(ctx context.Context, cfg *Config) context.Context

NewContext returns a copy of ctx which carries cfg.

Types

type Config

type Config struct {
	// App holds the value of the APP environment variable.
	App string

	Ports struct {
		// Global holds the value of the PORT_GLOBAL environment variable.
		Global int

		// Local holds the value of the PORT_LOCAL environment variable.
		Local int

		// Relay holds the value of the PORT_RELAY environment variable.
		Relay int

		// HTTP holds the value of the PORT_HTTP environment variable.
		HTTP int
	}
}

Config wraps the properties of the configuration.

func FromContext

func FromContext(ctx context.Context) *Config

FromContext returns the Config the given Context carries.

FromContext panics in case the given Context carries no Config.

func Load

func Load(logger *zap.Logger) (*Config, error)

Load loads the configuration from the environment.

func (*Config) Fields

func (cfg *Config) Fields() []zap.Field

Fields the Config in the form of a slice of zap.Field.

Jump to

Keyboard shortcuts

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