config

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2020 License: Apache-2.0 Imports: 11 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
}

Client holds configuration for http clients

func (Client) New added in v0.1.3

func (c Client) New() *http.Client

New creates a new instance of the HTTP Client

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"`
	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) GetLogger

func (c Config) GetLogger() *logrus.Logger

GetLogger generates a logger

func (Config) IsLocalHost

func (c Config) IsLocalHost() bool

IsLocalHost returns true if env is localhost

type Propeller

type Propeller struct {
	Host  string `envconfig:"PROPELLER_HOST"`
	Creds string `envconfig:"PROPELLER_CREDS"`
	Auth  propeller.Auth
	API   *url.URL
}

Propeller holds associated credentials for propeller api

func (*Propeller) NewClient added in v0.1.3

func (p *Propeller) NewClient(c Client) (*propeller.Client, error)

NewClient will set up the propeller client to track clients requests

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