config

package
v0.0.0-...-d2fa2ec Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrValidateNil       = errors.New("cavorite config must have a Validate() function")
	ErrValidate          = errors.New("validate() failed")
	ErrDirExpander       = errors.New("dirExpander failed")
	ErrDirExpanderNil    = errors.New("dirExpander cannot be nil")
	ErrMarshalNil        = errors.New("marshal cannot be nil")
	ErrUnsupportedStore  = errors.New("not a supported store type")
	ErrConfigNotExist    = errors.New("config file does not exist")
	ErrConfigDirNotExist = errors.New("config directory does not exist")
)
View Source
var (
	ErrViperReadConfig = errors.New("viper.ReadConfig failure")
)

Functions

func Load

func Load(fs afero.Fs, cfgDest ...*Config) error

func LoadOptions

func LoadOptions(fs afero.Fs) (stores.Options, error)

Types

type Config

type Config struct {
	StoreType stores.StoreType             `json:"store_type" mapstructure:"store_type"`
	Options   stores.Options               `json:"options" mapstructure:"options"`
	Validate  func() error                 `json:"-"`
	Expander  func(string) (string, error) `json:"-"`
	Marshal   func(v any) ([]byte, error)  `json:"-"`
}
var (
	Cfg Config
)

func InitalizeStoreTypeOf

func InitalizeStoreTypeOf(
	ctx context.Context,
	storeType stores.StoreType,
	fsys afero.Fs,
	sourceRepo string,
	opts stores.Options,
) Config

func (*Config) Write

func (c *Config) Write(fsys afero.Fs, sourceRepo string) error

Jump to

Keyboard shortcuts

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