config

package
v1.4.3-rc5 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

func SameFile added in v1.4.2

func SameFile(str1, str2 string) (bool, error)

SameFile compare two files. This method will first do the stat of two file and compare using os.SameFile method.

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 {
	DistSpecVersion string `json:"distSpecVersion" mapstructure:"distSpecVersion"`
	GoVersion       string
	Commit          string
	ReleaseTag      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.

type GlobalStorageConfig

type GlobalStorageConfig struct {
	StorageConfig `mapstructure:",squash"`
	SubPaths      map[string]StorageConfig
}

type HTTPConfig

type HTTPConfig struct {
	Address          string
	Port             string
	AllowOrigin      string // comma separated
	TLS              *TLSConfig
	Auth             *AuthConfig
	RawAccessControl map[string]interface{} `mapstructure:"accessControl,omitempty"`
	Realm            string
	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
	AnonymousPolicy []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
	Dedupe        bool
	RemoteCache   bool
	GC            bool
	Commit        bool
	GCDelay       time.Duration
	GCInterval    time.Duration
	StorageDriver map[string]interface{} `mapstructure:",omitempty"`
}

func (StorageConfig) ParamsEqual added in v1.4.2

func (expConfig StorageConfig) ParamsEqual(actConfig StorageConfig) bool

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