config

package
v0.0.0-...-b0fec18 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExpandPath

func ExpandPath(confpath, input string) string

Types

type Config

type Config struct {
	Concurrency      int                     `toml:"concurrency"`
	Shell            string                  `toml:"shell"`
	ShellCmdFlag     string                  `toml:"shell_flag"`
	DotEnvs          []string                `toml:"dotenvs"`
	KeyBindings      commander.KeyBindings   `toml:"key_bindings"`
	Sources          []Source                `toml:"sources"`
	Database         Database                `toml:"database"`
	Logs             Logs                    `toml:"logs"`
	CloneDirectories repofs.CloneDirectories `toml:"clone_directories"`
}

func Default

func Default() *Config

func New

func New(confpath string, reader io.Reader) (*Config, error)

func (Config) Dump

func (c Config) Dump() (string, error)

Dump returns the configuration as a TOML string.

func (Config) PrepareDirectories

func (c Config) PrepareDirectories() error

PrepareDirectories creates the directories for the configuration file, logs, and database file as required.

func (Config) Validate

func (c Config) Validate() error

type Database

type Database struct {
	File   string `toml:"file"`
	Params string `toml:"params"`
}

func (Database) DNS

func (d Database) DNS() string

func (Database) Validate

func (d Database) Validate() error

type Logs

type Logs struct {
	Level  zerolog.Level `toml:"level"`
	File   string        `toml:"file"`
	Color  bool          `toml:"color"`
	Format string        `toml:"format"`
}

type Source

type Source struct {
	Type     SourceType `toml:"type"`
	Username string     `toml:"username"`
	TokenKey string     `toml:"token"`
}

func (Source) Token

func (s Source) Token() string

func (Source) Validate

func (s Source) Validate() error

type SourceType

type SourceType string
var SourceTypeGithub SourceType = "github"

func (SourceType) IsValid

func (st SourceType) IsValid() bool

func (SourceType) String

func (st SourceType) String() string

Jump to

Keyboard shortcuts

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