config

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ConfigDir is the directory to store config file
	ConfigDir string
	// DefaultConfigFile is the default config file name
	DefaultConfigFile string
)

Directories

View Source
var (
	// ErrConfigNotMatch indicates error for no config matchs
	ErrConfigNotMatch = fmt.Errorf("no config matchs")
	// ErrEmptyEndpoint indicates error for empty endpoint
	ErrEmptyEndpoint = fmt.Errorf("no endpoint has been set")
)

Error strings

View Source
var ConfigCmd = &cobra.Command{
	Use:   "config",
	Short: "Set or get configuration for ioctl",
}

ConfigCmd represents the config command

Functions

func Get

func Get(arg string) (string, error)

Get gets config variable

func GetAddressOrAlias added in v0.8.0

func GetAddressOrAlias(args []string) (address string, err error)

GetAddressOrAlias gets address from args or context

func GetContextAddressOrAlias added in v0.8.0

func GetContextAddressOrAlias() (string, error)

GetContextAddressOrAlias gets current context

Types

type Config

type Config struct {
	Wallet         string            `yaml:"wallet"`
	Endpoint       string            `yaml:"endpoint"`
	SecureConnect  bool              `yaml:"secureConnect"`
	Aliases        map[string]string `yaml:"aliases"`
	CurrentContext Context           `yaml:"currentContext"`
}

Config defines the config schema

var (
	// ReadConfig represents the current config read from local
	ReadConfig Config
	// Insecure represents the insecure connect option of grpc dial, default is false
	Insecure = false
)

func LoadConfig

func LoadConfig() (Config, error)

LoadConfig loads config file in yaml format

type Context added in v0.8.0

type Context struct {
	AddressOrAlias string `yaml:"addressOralias"`
}

Context represents the current context

Jump to

Keyboard shortcuts

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