package utils
import "github.com/theupdateframework/notary/utils"
Index ¶
- func AdjustLogLevel(increment bool) error
- func ExportKeys(to io.Writer, s Exporter, from string) error
- func ExportKeysByGUN(to io.Writer, s Exporter, gun string) error
- func ExportKeysByID(to io.Writer, s Exporter, ids []string) error
- func GetPathRelativeToConfig(configuration *viper.Viper, key string) string
- func ImportKeys(from io.Reader, to []Importer, fallbackRole string, fallbackGUN string, passRet notary.PassRetriever) error
- func LogLevelSignalHandle(sig os.Signal)
- func ParseBugsnag(configuration *viper.Viper) (*bugsnag.Configuration, error)
- func ParseLogLevel(configuration *viper.Viper, defaultLevel logrus.Level) ( logrus.Level, error)
- func ParseServerTLS(configuration *viper.Viper, tlsRequired bool) (*tls.Config, error)
- func ParseViper(v *viper.Viper, configFile string) error
- func RootHandlerFactory(ctx context.Context, auth auth.AccessController, trust signed.CryptoService) func(ContextHandler, ...string) *rootHandler
- func SetLastModifiedHeader(headers http.Header, lmt time.Time)
- func SetUpBugsnag(config *bugsnag.Configuration) error
- func SetupSignalTrap(handler func(os.Signal)) chan os.Signal
- func SetupViper(v *viper.Viper, envPrefix string)
- func WrapWithCacheHandler(ccc CacheControlConfig, handler http.Handler) http.Handler
- type CacheControlConfig
- type ContextHandler
- type Exporter
- type Importer
- type NoCacheControl
- type PublicCacheControl
- type RethinkDBStorage
- type Storage
Functions ¶
func AdjustLogLevel ¶
AdjustLogLevel increases/decreases the log level, return error if the operation is invaild.
func ExportKeys ¶
ExportKeys copies a key from the store to the io.Writer
func ExportKeysByGUN ¶
ExportKeysByGUN exports all keys filtered to a GUN
func ExportKeysByID ¶
ExportKeysByID exports all keys matching the given ID
func GetPathRelativeToConfig ¶
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 ImportKeys ¶
func ImportKeys(from io.Reader, to []Importer, fallbackRole string, fallbackGUN string, passRet notary.PassRetriever) error
ImportKeys expects an io.Reader containing one or more PEM blocks. It reads PEM blocks one at a time until pem.Decode returns a nil block. Each block is written to the subpath indicated in the "path" PEM header. If the file already exists, the file is truncated. Multiple adjacent PEMs with the same "path" header are appended together.
func LogLevelSignalHandle ¶
LogLevelSignalHandle will increase/decrease the logging level via the signal we get.
func ParseBugsnag ¶
ParseBugsnag tries to parse out a Bugsnag Configuration from a Viper. If no values are provided, returns a nil pointer.
func ParseLogLevel ¶
ParseLogLevel tries to parse out a log level from a Viper. If there is no configuration, defaults to the provided error level
func ParseServerTLS ¶
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 ¶
ParseViper tries to parse out a Viper from a configuration file.
func RootHandlerFactory ¶
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 ¶
SetLastModifiedHeader takes a time and uses it to set the LastModified header using the right date format
func SetUpBugsnag ¶
func SetUpBugsnag(config *bugsnag.Configuration) error
SetUpBugsnag configures bugsnag and sets up a logrus hook
func SetupSignalTrap ¶
SetupSignalTrap is a utility to trap supported signals hand handle them (currently by increasing logging)
func SetupViper ¶
SetupViper sets up an instance of viper to also look at environment variables
func WrapWithCacheHandler ¶
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
Types ¶
type CacheControlConfig ¶
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 ¶
func NewCacheControlConfig(maxAgeInSeconds int, mustRevalidate bool) CacheControlConfig
NewCacheControlConfig returns CacheControlConfig interface for either setting cache control or disabling cache control entirely
type ContextHandler ¶
ContextHandler defines an alternate HTTP handler interface which takes in a context for authorization and returns an HTTP application error.
type Exporter ¶
Exporter is a simple interface for the two functions we need from the Storage interface
type Importer ¶
Importer is a simple interface for the one function we need from the Storage interface
type NoCacheControl ¶
type NoCacheControl struct{}
NoCacheControl is an object which represents a directive to cache nothing
func (NoCacheControl) SetHeaders ¶
func (n NoCacheControl) SetHeaders(headers http.Header)
SetHeaders sets the public headers cache-control headers and pragma to no-cache
type PublicCacheControl ¶
PublicCacheControl is a set of options that we will set to enable cache control
func (PublicCacheControl) SetHeaders ¶
func (p PublicCacheControl) SetHeaders(headers http.Header)
SetHeaders sets the public headers with an optional must-revalidate header
type RethinkDBStorage ¶
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 ¶
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 ¶
Storage is a configuration about what storage backend a server should use
func ParseSQLStorage ¶
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.)
Source Files ¶
configuration.go configuration_nowindows.go http.go keys.go
- Version
- v0.5.0
- Published
- Nov 14, 2016
- Platform
- js/wasm
- Imports
- 28 packages
- Last checked
- 1 day ago –
Tools for package owners.