util

package
v0.0.0-...-08bf4ff Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2016 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPaths

func GetPaths(filenames []string) []string

GetPaths returns absolute paths for input filenames. If file exists in user's config folder, returns path to it, otherwise returns path to file in 'config/' folder. If the file starts with a '/' and exists, leaves it alone - we are using absolute paths for some reason

func InitConfig

func InitConfig()

func LoadConfig

func LoadConfig()

LoadConfig loads configuration using a hard-coded name This is what gets called during normal operation

func LoadConfigByPathWOExtension

func LoadConfigByPathWOExtension(name string)

LoadConfigByName loads a config from a specific file Used for separating test from operational configuration

func LoggingHandler

func LoggingHandler(inner http.Handler) http.Handler

HTTP logging handler

func MakeLogger

func MakeLogger(w http.ResponseWriter) statResponseWriter

func SendHeaders

func SendHeaders(w http.ResponseWriter)

func SetupSvcLogging

func SetupSvcLogging(env *string)

func StatsHandler

func StatsHandler(w http.ResponseWriter, r *http.Request)

Stats is a handler for displaying API statistics

Types

type Config

type Config struct {
	Version int
	Storage struct {
		Filepath string
	}
	Authn struct {
		MintKeyName     string
		ValidateKeyName string
		TokenTTL        int64
		PwdProvider     struct {
			PwdFileName string
			Salt        string
		}
	}
	Authz struct {
		Provider     string
		LDAPProvider struct {
			User     string
			Password string
		}
	}
}

Config is the data structure for passing configuration info

func GetConfig

func GetConfig() *Config

TODO: make it so it loads the config if it is not there

type Error

type Error struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

type Telemetry

type Telemetry struct {
	// contains filtered or unexported fields
}

Telemetry keeps all the meters for a given route

func NewTelemetry

func NewTelemetry(i http.Handler, name string) Telemetry

NewTelemetry generates a new telemetry handler that is properly initialized for the name

func (Telemetry) ServeHTTP

func (t Telemetry) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP delegates the serving to the inner handler and updates telemetry

Jump to

Keyboard shortcuts

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