config

package
v0.0.1-beta Latest Latest
Warning

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

Go to latest
Published: May 13, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModeFile    = "file"
	ModeLink    = "link"
	ModeDefault = ModeFile

	Version1      = "v1"
	ConfigVersion = Version1
)
View Source
const (
	ConfigFileName = "dotato.yaml"
)

Variables

View Source
var (
	ErrVersionNotFound  = fmt.Errorf("version not found")
	ErrModeNotFound     = fmt.Errorf("mode not found")
	ErrGroupNotFound    = fmt.Errorf("group not found")
	ErrResolverNotFound = fmt.Errorf("resolver not found")
)

Functions

func GetExample

func GetExample() string

func Write

func Write(fs billy.Filesystem, filepath string, cfg *Config) error

Types

type Config

type Config struct {
	Version string                       `yaml:"version"`
	Mode    string                       `yaml:"mode"`
	Plans   map[string][]string          `yaml:"plans"`
	Groups  map[string]map[string]string `yaml:"groups"`
}

func New

func New() *Config

func NewFromByte

func NewFromByte(data []byte) (*Config, error)

func NewFromString

func NewFromString(str string) (*Config, error)

func Read

func Read(fs billy.Filesystem, filepath string) (*Config, bool, error)

func ReadRecur

func ReadRecur(fs billy.Filesystem, dir gp.GardenPath, filename string) (*Config, gp.GardenPath, error)

ReadConfigRecur tries to find config file by walking up the directory tree. It returns the directory of the config file.

func (Config) GetGroupBase

func (c Config) GetGroupBase(
	group, resolver string,
) (
	base gp.GardenPath,
	notFound []string,
	err error,
)

func (Config) GetGroupBaseAll

func (c Config) GetGroupBaseAll(resolver string) (groups map[string]gp.GardenPath, notFound []string, err error)

Returns:

  • groups - map of group and base pairs
  • notFound - env vars that are not found in the base
  • err - error if any

func (Config) GetGroups

func (c Config) GetGroups(plan string) map[string]bool

Returns groups of the plan as a map.

If a plan has empty list, it returns all groups.

func (Config) IsEqual

func (r Config) IsEqual(other *Config) bool

For testing purpose

Jump to

Keyboard shortcuts

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