config

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2020 License: Apache-2.0 Imports: 14 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 {
	Context context.Context
	Timeout time.Duration `envconfig:"CLIENT_TIMEOUT" default:"5s"`
	Tracer  tracing.Tracer
	HTTPClient
}

Client holds configuration for http clients

func (*Client) SetContext added in v0.1.3

func (c *Client) SetContext(r *http.Request)

SetContext will set the context on the incoming requests

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"`
	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 key,value or 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 {
	Host  string `envconfig:"PROPELLER_HOST"`
	Creds string `envconfig:"PROPELLER_CREDS"`
	propeller.Client
}

Propeller holds associated credentials for propeller api

func (*Propeller) UpdateContext added in v0.1.10

func (p *Propeller) UpdateContext(ctx context.Context)

UpdateContext will update client context

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