notary: github.com/docker/notary/utils Index | Files

package utils

import "github.com/docker/notary/utils"

Index

Package Files

configuration.go configuration_nowindows.go http.go

func AdjustLogLevel Uses

func AdjustLogLevel(increment bool) error

AdjustLogLevel increases/decreases the log level, return error if the operation is invalid.

func GetPathRelativeToConfig Uses

func GetPathRelativeToConfig(configuration *viper.Viper, key string) string

GetPathRelativeToConfig gets a configuration key which is a path, and if it is not empty or an absolute path, returns the absolute path relative to the configuration file

func LogLevelSignalHandle Uses

func LogLevelSignalHandle(sig os.Signal)

LogLevelSignalHandle will increase/decrease the logging level via the signal we get.

func ParseBugsnag Uses

func ParseBugsnag(configuration *viper.Viper) (*bugsnag.Configuration, error)

ParseBugsnag tries to parse out a Bugsnag Configuration from a Viper. If no values are provided, returns a nil pointer.

func ParseLogLevel Uses

func ParseLogLevel(configuration *viper.Viper, defaultLevel logrus.Level) (
    logrus.Level, error)

ParseLogLevel tries to parse out a log level from a Viper. If there is no configuration, defaults to the provided error level

func ParseServerTLS Uses

func ParseServerTLS(configuration *viper.Viper, tlsRequired bool) (*tls.Config, error)

ParseServerTLS tries to parse out valid server TLS options from a Viper. The cert/key files are relative to the config file used to populate the instance of viper.

func ParseViper Uses

func ParseViper(v *viper.Viper, configFile string) error

ParseViper tries to parse out a Viper from a configuration file.

func RootHandlerFactory Uses

func RootHandlerFactory(ctx context.Context, auth auth.AccessController, trust signed.CryptoService) func(ContextHandler, ...string) *rootHandler

RootHandlerFactory creates a new rootHandler factory using the given Context creator and authorizer. The returned factory allows creating new rootHandlers from the alternate http handler contextHandler and a scope.

func SetLastModifiedHeader Uses

func SetLastModifiedHeader(headers http.Header, lmt time.Time)

SetLastModifiedHeader takes a time and uses it to set the LastModified header using the right date format

func SetUpBugsnag Uses

func SetUpBugsnag(config *bugsnag.Configuration) error

SetUpBugsnag configures bugsnag and sets up a logrus hook

func SetupSignalTrap Uses

func SetupSignalTrap(handler func(os.Signal)) chan os.Signal

SetupSignalTrap is a utility to trap supported signals hand handle them (currently by increasing logging)

func SetupViper Uses

func SetupViper(v *viper.Viper, envPrefix string)

SetupViper sets up an instance of viper to also look at environment variables

func WrapWithCacheHandler Uses

func WrapWithCacheHandler(ccc CacheControlConfig, handler http.Handler) http.Handler

WrapWithCacheHandler wraps another handler in one that can add cache control headers given a 200 response

type AuthWrapper Uses

type AuthWrapper func(ContextHandler, ...string) *rootHandler

AuthWrapper wraps a Handler with and Auth requirement

type CacheControlConfig Uses

type CacheControlConfig interface {
    // SetHeaders will actually set the cache control headers on a Headers object
    SetHeaders(headers http.Header)
}

CacheControlConfig is an interface for something that knows how to set cache control headers

func NewCacheControlConfig Uses

func NewCacheControlConfig(maxAgeInSeconds int, mustRevalidate bool) CacheControlConfig

NewCacheControlConfig returns CacheControlConfig interface for either setting cache control or disabling cache control entirely

type ContextHandler Uses

type ContextHandler func(ctx context.Context, w http.ResponseWriter, r *http.Request) error

ContextHandler defines an alternate HTTP handler interface which takes in a context for authorization and returns an HTTP application error.

type NoCacheControl Uses

type NoCacheControl struct{}

NoCacheControl is an object which represents a directive to cache nothing

func (NoCacheControl) SetHeaders Uses

func (n NoCacheControl) SetHeaders(headers http.Header)

SetHeaders sets the public headers cache-control headers and pragma to no-cache

type PublicCacheControl Uses

type PublicCacheControl struct {
    MustReValidate  bool
    MaxAgeInSeconds int
}

PublicCacheControl is a set of options that we will set to enable cache control

func (PublicCacheControl) SetHeaders Uses

func (p PublicCacheControl) SetHeaders(headers http.Header)

SetHeaders sets the public headers with an optional must-revalidate header

type RethinkDBStorage Uses

type RethinkDBStorage struct {
    Storage
    CA       string
    Cert     string
    DBName   string
    Key      string
    Username string
    Password string
}

RethinkDBStorage is configuration about a RethinkDB backend service

func ParseRethinkDBStorage Uses

func ParseRethinkDBStorage(configuration *viper.Viper) (*RethinkDBStorage, error)

ParseRethinkDBStorage tries to parse out Storage from a Viper. If backend and URL are not provided, returns a nil pointer. Storage is required (if a backend is not provided, an error will be returned.)

type Storage Uses

type Storage struct {
    Backend string
    Source  string
}

Storage is a configuration about what storage backend a server should use

func ParseSQLStorage Uses

func ParseSQLStorage(configuration *viper.Viper) (*Storage, error)

ParseSQLStorage tries to parse out Storage from a Viper. If backend and URL are not provided, returns a nil pointer. Storage is required (if a backend is not provided, an error will be returned.)

Package utils imports 22 packages (graph) and is imported by 11 packages. Updated 2019-08-19. Refresh now. Tools for package owners.