config

package
v1.3.8-rc2 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Commit     string // nolint: gochecknoglobals
	BinaryType string // nolint: gochecknoglobals
	GoVersion  string // nolint: gochecknoglobals
)

Functions

This section is empty.

Types

type AccessControlConfig

type AccessControlConfig struct {
	Repositories Repositories
	AdminPolicy  Policy
}

type AuthConfig

type AuthConfig struct {
	FailDelay int
	HTPasswd  AuthHTPasswd
	LDAP      *LDAPConfig
	Bearer    *BearerConfig
}

type AuthHTPasswd

type AuthHTPasswd struct {
	Path string
}

type BearerConfig

type BearerConfig struct {
	Realm   string
	Service string
	Cert    string
}

type Config

type Config struct {
	Version       string
	GoVersion     string
	Commit        string
	BinaryType    string
	AccessControl *AccessControlConfig
	Storage       GlobalStorageConfig
	HTTP          HTTPConfig
	Log           *LogConfig
	Extensions    *extconf.ExtensionConfig
}

func New

func New() *Config

func (*Config) LoadAccessControlConfig

func (c *Config) LoadAccessControlConfig(viperInstance *viper.Viper) error

LoadAccessControlConfig populates config.AccessControl struct with values from config.

func (*Config) Sanitize

func (c *Config) Sanitize() *Config

Sanitize makes a sanitized copy of the config removing any secrets.

func (*Config) Validate

func (c *Config) Validate(log log.Logger) error

type GlobalStorageConfig

type GlobalStorageConfig struct {
	Dedupe        bool
	GC            bool
	Commit        bool
	RootDirectory string
	StorageDriver map[string]interface{} `mapstructure:",omitempty"`
	SubPaths      map[string]StorageConfig
}

type HTTPConfig

type HTTPConfig struct {
	Address          string
	Port             string
	TLS              *TLSConfig
	Auth             *AuthConfig
	RawAccessControl map[string]interface{} `mapstructure:"accessControl,omitempty"`
	Realm            string
	AllowReadAccess  bool             `mapstructure:",omitempty"`
	ReadOnly         bool             `mapstructure:",omitempty"`
	Ratelimit        *RatelimitConfig `mapstructure:",omitempty"`
}

type LDAPConfig

type LDAPConfig struct {
	Port          int
	Insecure      bool
	StartTLS      bool // if !Insecure, then StartTLS or LDAPs
	SkipVerify    bool
	SubtreeSearch bool
	Address       string
	BindDN        string
	BindPassword  string
	BaseDN        string
	UserAttribute string
	CACert        string
}

type LogConfig

type LogConfig struct {
	Level  string
	Output string
	Audit  string
}

type MethodRatelimitConfig added in v1.3.8

type MethodRatelimitConfig struct {
	Method string
	Rate   int
}

type Policy

type Policy struct {
	Users   []string
	Actions []string
}

type PolicyGroup

type PolicyGroup struct {
	Policies      []Policy
	DefaultPolicy []string
}

type RatelimitConfig added in v1.3.8

type RatelimitConfig struct {
	Rate    *int                    // requests per second
	Methods []MethodRatelimitConfig `mapstructure:",omitempty"`
}

type Repositories

type Repositories map[string]PolicyGroup

type StorageConfig

type StorageConfig struct {
	RootDirectory string
	GC            bool
	Dedupe        bool
	Commit        bool
	StorageDriver map[string]interface{} `mapstructure:",omitempty"`
}

type TLSConfig

type TLSConfig struct {
	Cert   string
	Key    string
	CACert string
}

Jump to

Keyboard shortcuts

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