config

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2021 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VersionV1 = "v1"
)

Variables

View Source
var (
	ErrSDKNotInConfig = errors.New("The config.SDKConfig for the given SDK-key is not available inside the config.Config")
)
View Source
var ReadConfigFile = func(filename string) ([]byte, error) {
	f, err := os.Open(filename)
	if err != nil {
		return nil, errors.Wrapf(err, "failed to open '%s'", filename)
	}
	defer f.Close()

	data, err := ioutil.ReadAll(f)
	if err != nil {
		return nil, err
	}

	return data, nil
}

Functions

func InitViper

func InitViper(filename string)

func Save

func Save(fs afero.Fs, pather devctlpath.Pather, cfg *Config) (err error)

func UpdateDevEnvConfig

func UpdateDevEnvConfig(cfg DevEnvConfig) error

func WriteDevEnvConfig

func WriteDevEnvConfig(filepath string, cfg DevEnvConfig) error

Types

type Config

type Config struct {
	Version string     `yaml:"version"`
	Sdks    SdksConfig `yaml:"Sdks"`
}

func Load

func Load(fs afero.Fs, pather devctlpath.Pather) (cfg *Config, err error)

func LoadOrCreate

func LoadOrCreate(fs afero.Fs, pather devctlpath.Pather) (cfg *Config, err error)

func NewBlankConfig

func NewBlankConfig() (c *Config)

func (*Config) Apply

func (c *Config) Apply(updateFn func(*Config)) *Config

type DevEnvConfig

type DevEnvConfig struct {
	GlobalConfig DevEnvGlobalConfig         `yaml:"global,omitempty" json:"global,omitempty" mapstructure:"global,omitempty"`
	Sdks         map[string]DevEnvSDKConfig `yaml:"sdks,omitempty" json:"sdks,omitempty" mapstructure:"sdks,omitempty"`
}

func DefaultConfig

func DefaultConfig() *DevEnvConfig

DefaultConfig creates a blank *DevEnvConfig

func LoadViperConfig

func LoadViperConfig() *DevEnvConfig

func (*DevEnvConfig) GoString

func (d *DevEnvConfig) GoString() string

type DevEnvGlobalConfig

type DevEnvGlobalConfig struct {
	Version string `yaml:"version,omitempty" json:"version,omitempty" mapstructure:"version,omitempty"`
}

type DevEnvSDKConfig

type DevEnvSDKConfig struct {
	Current    string         `yaml:"current,omitempty" json:"current,omitempty" mapstructure:"current,omitempty"`
	Candidates []SDKCandidate `yaml:"candidates,omitempty"  json:"candidates,omitempty" mapstructure:"candidates,omitempty"`
}

type SDKCandidate

type SDKCandidate struct {
	Path    string `yaml:"path,omitempty" json:"path,omitempty" mapstructure:"path,omitempty"`
	Version string `yaml:"version,omitempty" json:"version,omitempty" mapstructure:"version,omitempty"`
}

type SdkConfig

type SdkConfig struct {
	SDK           string            `yaml:"sdk"`
	Current       string            `yaml:"current"`
	Installations map[string]string `yaml:"installations"`
}

func NewSdkConfig

func NewSdkConfig(sdk string) SdkConfig

func (*SdkConfig) GetInstallation

func (c *SdkConfig) GetInstallation(version string) (path string, err error)

type SdksConfig

type SdksConfig map[string]SdkConfig

Jump to

Keyboard shortcuts

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