server

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2024 License: GPL-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = Config{
	FileSystem:            "default",
	DockerEndpoint:        "unix:///var/run/docker.sock",
	LogFile:               "/dev/stderr",
	Owner:                 fmt.Sprintf("%d:%d", os.Getuid(), os.Getgid()),
	RepoLogsDir:           "/var/log/yuki/",
	ListenAddr:            "127.0.0.1:9999",
	NamePrefix:            "syncing-",
	LogLevel:              "info",
	ImagesUpgradeInterval: time.Hour,
}

Functions

This section is empty.

Types

type Config

type Config struct {
	Debug                 bool          `mapstructure:"debug"`
	DbURL                 string        `mapstructure:"db_url" validate:"required"`
	FileSystem            string        `mapstructure:"fs" validate:"oneof=xfs zfs default"`
	DockerEndpoint        string        `mapstructure:"docker_endpoint" validate:"unix_addr|tcp_addr"`
	Owner                 string        `mapstructure:"owner"`
	LogFile               string        `mapstructure:"log_file" validate:"filepath"`
	RepoLogsDir           string        `mapstructure:"repo_logs_dir" validate:"dir"`
	RepoConfigDir         []string      `mapstructure:"repo_config_dir" validate:"required,dive,dir"`
	LogLevel              string        `mapstructure:"log_level" validate:"oneof=debug info warn error"`
	ListenAddr            string        `mapstructure:"listen_addr" validate:"hostname_port"`
	BindIP                string        `mapstructure:"bind_ip" validate:"omitempty,ip"`
	NamePrefix            string        `mapstructure:"name_prefix"`
	PostSync              []string      `mapstructure:"post_sync"`
	ImagesUpgradeInterval time.Duration `mapstructure:"images_upgrade_interval" validate:"min=0"`
	SyncTimeout           time.Duration `mapstructure:"sync_timeout" validate:"min=0"`
}

type Server

type Server struct {
	// contains filtered or unexported fields
}

func New

func New(configPath string) (*Server, error)

func NewWithConfig

func NewWithConfig(cfg Config) (*Server, error)

func (*Server) ListenAddr added in v0.4.0

func (s *Server) ListenAddr() string

ListenAddr returns the actual address the server is listening on. It is useful when the server is configured to listen on a random port.

func (*Server) Start

func (s *Server) Start(rootCtx context.Context) error

Jump to

Keyboard shortcuts

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