config

package
v0.1.19 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 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 Client added in v0.1.3

type Client struct {
	Timeout time.Duration `envconfig:"CLIENT_TIMEOUT" default:"5s"`
	Tracer  tracing.Tracer
	HTTPClient
}

Client holds configuration for http clients

type Config

type Config struct {
	Listen      string `envconfig:"HTTP_PORT" default:":8080"`
	LogLevel    string `envconfig:"LOG_LEVEL" default:"debug"`
	OriginHost  string `envconfig:"ORIGIN_HOST"`
	Hostname    string `envconfig:"HOSTNAME"  default:"localhost"`
	OriginKey   string `encovnfig:"ORIGIN_KEY" default:"x-bakery-origin-token"`
	OriginToken string `envconfig:"ORIGIN_TOKEN"`
	AuthEnabled bool   `envconfig:"ENABLE_AUTH" default:"false"`
	Logger      zerolog.Logger
	Tracer
	Client
	Propeller
}

Config holds all the configuration for this service

func LoadConfig

func LoadConfig() (Config, error)

LoadConfig loads the configuration with environment variables injected

func (Config) IsLocalHost

func (c Config) IsLocalHost() bool

IsLocalHost returns true if env is localhost

func (Config) SetupMiddleware added in v0.1.5

func (c Config) SetupMiddleware() alice.Chain

SetupMiddleware appends request logging context to use in your handler

func (Config) ValidateAuthHeader added in v0.1.5

func (c Config) ValidateAuthHeader() error

ValidateAuthHeader returns error if not set

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

HTTPClient hold interface declaration of our http clients

type Propeller

type Propeller struct {
	Enabled bool   `envconfig:"PROPELLER_ENABLED" default:"false"`
	Host    string `envconfig:"PROPELLER_HOST"`
	Creds   string `envconfig:"PROPELLER_CREDS"`
	propeller.Client
}

Propeller holds associated credentials for propeller api

func (*Propeller) IsEnabled added in v0.1.18

func (p *Propeller) IsEnabled() bool

type Tracer added in v0.1.3

type Tracer struct {
	EnableXRay        bool `envconfig:"ENABLE_XRAY" default:"false"`
	EnableXRayPlugins bool `envconfig:"ENABLE_XRAY_PLUGINS" default:"false"`
}

Tracer holds configuration for initating the tracing of requests

Jump to

Keyboard shortcuts

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