iotex-core: github.com/iotexproject/iotex-core/ioctl/cmd/config Index | Files

package config

import "github.com/iotexproject/iotex-core/ioctl/cmd/config"

Index

Package Files

config.go configsetget.go

Variables

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

Directories

var (
    // ErrConfigNotMatch indicates error for no config matches
    ErrConfigNotMatch = fmt.Errorf("No matching config")
    // ErrEmptyEndpoint indicates error for empty endpoint
    ErrEmptyEndpoint = fmt.Errorf("No endpoint has been set")
)

Error strings

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
    // UILanguage represents the language of ioctl user interface, default is 0 representing English
    UILanguage Language
)
var ConfigCmd = &cobra.Command{
    Use:   "config",
    Short: "Get, set, or reset configuration for ioctl",
}

ConfigCmd represents the config command

func Get Uses

func Get(arg string) error

Get gets config variable

func GetAddressOrAlias Uses

func GetAddressOrAlias(in string) (address string, err error)

GetAddressOrAlias gets address from args or context

func GetContextAddressOrAlias Uses

func GetContextAddressOrAlias() (string, error)

GetContextAddressOrAlias gets current context

func TranslateInLang Uses

func TranslateInLang(translations map[Language]string, lang Language) string

TranslateInLang returns translation in selected language

type Config Uses

type Config struct {
    Wallet         string            `json:"wallet" yaml:"wallet"`
    Endpoint       string            `json:"endpoint" yaml:"endpoint"`
    SecureConnect  bool              `json:"secureConnect" yaml:"secureConnect"`
    Aliases        map[string]string `json:"aliases" yaml:"aliases"`
    DefaultAccount Context           `json:"defaultAccount" yaml:"defaultAccount"`
    Explorer       string            `json:"explorer" yaml:"explorer"`
    Language       string            `json:"language" yaml:"language"`
}

Config defines the config schema

func LoadConfig Uses

func LoadConfig() (Config, error)

LoadConfig loads config file in yaml format

func (*Config) String Uses

func (m *Config) String() string

type Context Uses

type Context struct {
    AddressOrAlias string `json:"addressOrAlias" yaml:"addressOrAlias"`
}

Context represents the current context

func (*Context) String Uses

func (m *Context) String() string

type Language Uses

type Language int

Language type used to enumerate supported language of ioctl

const (
    English Language = iota
    Chinese
)

Multi-language support

Package config imports 11 packages (graph) and is imported by 8 packages. Updated 2019-11-22. Refresh now. Tools for package owners.