0
Fork 0
mirror of https://github.com/project-zot/zot.git synced 2025-01-06 22:40:28 -05:00
zot/pkg/api/config.go
2019-09-16 11:58:32 -07:00

58 lines
1,016 B
Go

package api
import (
dspec "github.com/opencontainers/distribution-spec"
)
//nolint (gochecknoglobals)
var Commit string
type StorageConfig struct {
RootDirectory string
}
type TLSConfig struct {
Cert string
Key string
CACert string
}
type AuthHTPasswd struct {
Path string
}
type AuthConfig struct {
FailDelay int
HTPasswd AuthHTPasswd
}
type HTTPConfig struct {
Address string
Port string
TLS TLSConfig `mapstructure:",omitempty"`
Auth AuthConfig `mapstructure:",omitempty"`
Realm string
AllowReadAccess bool `mapstructure:",omitempty"`
}
type LogConfig struct {
Level string
Output string
}
type Config struct {
Version string
Commit string
Storage StorageConfig
HTTP HTTPConfig
Log LogConfig `mapstructure:",omitempty"`
}
func NewConfig() *Config {
return &Config{
Version: dspec.Version,
Commit: Commit,
HTTP: HTTPConfig{Address: "127.0.0.1", Port: "8080"},
Log: LogConfig{Level: "debug"},
}
}