Documentation ¶
Index ¶
- type App
- type Cache
- type CacheType
- type Config
- type Github
- type GoProxy
- type License
- type MaskedString
- type MaskedURL
- type ModuleMatcher
- type NotificationType
- type OverridePath
- type Redis
- type RuleSet
- type Server
- type Trace
- type TracerType
- type UnknownLicenseAction
- type Validation
- type WebhookNotification
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct { // Type is a cache type // Available types: // * memory // * memlru (SizeItems required) // * redis Type CacheType // SizeItems is a maximum items count in memory lru cache SizeItems int Redis Redis }
Cache represents cache configuration
type Config ¶
type Config struct { // Debug is a flag to enable debug logging Debug bool // Cache is optional cache configuration. // Cache will not be used if not present (not recommended). Cache *Cache Github Github GoProxy GoProxy // PathOverrides contains set of rules for translation module names PathOverrides []OverridePath Validation Validation Server Server // HealthServer is a server for liveness and readiness probe handlers. // These handlers not added to main server because on graceful shutdown it puts app into false unhealthy status. // Server will not be started if section not provided. HealthServer *Server // Trace is optional tracing/telemetry configuration. // Tracing will not be enabled if option not provided. Trace *Trace }
Config is a top-level app config
func ConfigFromFile ¶
type Github ¶
type Github struct { // AccessToken is optional github access token // It's needed to access private repos or increase rate-limit AccessToken MaskedString }
Github contains github client configuration
type GoProxy ¶
type GoProxy struct { // BaseURL is a goproxy basic url // Obviously it must not be athens url which will use this app BaseURL MaskedURL }
GoProxy contains goproxy client configuration
type License ¶
type License struct { // SPDXID is a spdx license id SPDXID string `toml:",omitempty"` // Name is a human-readable name Name string }
License represents a license
type MaskedString ¶
type MaskedString string
MaskedString is a string that will be always represented as "****" in json
func (MaskedString) MarshalJSON ¶
func (m MaskedString) MarshalJSON() ([]byte, error)
type MaskedURL ¶
type MaskedURL string
MaskedURL is an url that will be represented with masked password in json
func (MaskedURL) MarshalJSON ¶
type ModuleMatcher ¶
type ModuleMatcher struct { // Name is a regular expression for name Name string // VersionConstraint is a semver version constraint (for syntax see https://github.com/Masterminds/semver/#checking-version-constraints) VersionConstraint string `toml:",omitempty"` }
ModuleMatcher represents a module matcher configuration
type NotificationType ¶ added in v0.0.5
type NotificationType string
const (
NotificationTypeWebhook NotificationType = "webhook"
)
type OverridePath ¶
type OverridePath struct { // Match is a regular expression to match module name Match string // Replace is a replacement string for module name. // Regexp capturing group placeholders (i.e $1, $2) may be used here. Replace string }
OverridePath is a single override for module path
type Redis ¶ added in v0.0.3
type Redis struct { // Addrs is a slice of connection addresses // If more than one provided cluster client will be used Addrs []string // TTL is optional ttl for keys. Keys will not expire when TTL is not set. TTL time.Duration // PoolSize is a connection pool size. Default value is 10 PoolSize int // DB allows to select db number DB int // Password is an optional password Password MaskedString // ConnectTimeout is an optional connect timeout ConnectTimeout time.Duration // ReadTimeout is an optional timeout to receive data ReadTimeout time.Duration // WriteTimeout is an optional timeout to send data WriteTimeout time.Duration }
Redis represents redis configuration
type RuleSet ¶
type RuleSet struct { // WhitelistedModules always passes validation WhitelistedModules []ModuleMatcher // BlacklistedModules always fails validation BlacklistedModules []ModuleMatcher // AllowedLicenses contains set of allowed licenses // Note that if it's not empty only these licenses will be allowed. AllowedLicenses []License // DeniedLicenses contains set of denied licenses DeniedLicenses []License }
RuleSet defines a validation rule set
type Server ¶
type Server struct { // ListenAddr is a listen address (i.e. ':8080') ListenAddr string // EnablePprof adds pprof handlers to server at /pprof EnablePprof bool }
Server represents http-server configuration
type Trace ¶ added in v0.0.4
type Trace struct { // CollectorAddress is a traces collector address CollectorAddress string // TracerType is a trace collector type. Available types: // * zipkin // * jaeger TracerType TracerType // SampleProbability samples a given fraction of traces. Fractions >= 1 or <= 0 will // always sample. If the parent span is sampled, then it's child spans will // automatically be sampled SampleProbability float64 }
Trace represents opentelemetry configuration
type TracerType ¶ added in v0.0.4
type TracerType string
const ( ZipkinTracer TracerType = "zipkin" JaegerTracer TracerType = "jaeger" )
type UnknownLicenseAction ¶
type UnknownLicenseAction string
const ( UnknownLicenseAllow UnknownLicenseAction = "allow" UnknownLicenseWarn UnknownLicenseAction = "warn" UnknownLicenseDeny UnknownLicenseAction = "deny" )
type Validation ¶
type Validation struct { // UnknownLicenseAction specifies what to do if unknown license met. // Currently available: // * allow - simply allow such module // * warn - allows such module but notifies // * deny - fails module validation UnknownLicenseAction UnknownLicenseAction // ConfidenceThreshold is a lower bound for license matching confidence when it's done by go-license-detector ConfidenceThreshold float64 RuleSet RuleSet // NotificationType is an unknown license notification type NotificationType NotificationType Webhook *WebhookNotification }
Validation contains validator config values
type WebhookNotification ¶ added in v0.0.5
type WebhookNotification struct { // Address is a target webhook addres (full url) Address MaskedURL // Method is optional http method for webhook request. Default is POST. Method string // Headers contains additional http headers for webhook request. Headers map[string]string // BodyTemplate is optional request body template string in 'text/template' syntax. // Execution context defined in 'pkg/validation.WebhookTemplateContext'. // Also helper function 'toJSON' is available that converts input argument to json string. BodyTemplate string }