config

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Callbacks

type Callbacks interface {
	Tui(action string)
	Push(repo string)
	Fetch(repo string)
}

Callbacks provides an interface that can be used to run callbacks on different events.

type Config

type Config struct {
	BindAddr         string   `env:"SOFT_SERVE_BIND_ADDRESS" envDefault:""`
	Port             int      `env:"SOFT_SERVE_PORT" envDefault:"23231"`
	KeyPath          string   `env:"SOFT_SERVE_KEY_PATH"`
	RepoPath         string   `env:"SOFT_SERVE_REPO_PATH" envDefault:".repos"`
	InitialAdminKeys []string `env:"SOFT_SERVE_INITIAL_ADMIN_KEY" envSeparator:"\n"`
	Callbacks        Callbacks
	ErrorLog         *log.Logger
}

Config is the configuration for Soft Serve.

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns a Config with the values populated with the defaults or specified environment variables.

func (*Config) WithCallbacks

func (c *Config) WithCallbacks(callbacks Callbacks) *Config

WithCallbacks applies the given Callbacks to the configuration.

func (*Config) WithErrorLogger added in v0.2.0

func (c *Config) WithErrorLogger(logger *log.Logger) *Config

WithErrorLogger sets the error logger for the configuration.

Jump to

Keyboard shortcuts

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