Documentation ¶
Overview ¶
Package config contains a Config struct for QingCloud SDK.
Index ¶
Constants ¶
const DefaultConfigFile = "~/.qingcloud/config.yaml"
DefaultConfigFile is the default config file.
const DefaultConfigFileContent = `` /* 351-byte string literal not displayed */
DefaultConfigFileContent is the default config file content.
Variables ¶
This section is empty.
Functions ¶
func GetUserConfigFilePath ¶
func GetUserConfigFilePath() string
GetUserConfigFilePath returns the user config file path.
func InstallDefaultUserConfig ¶
func InstallDefaultUserConfig() error
InstallDefaultUserConfig install the default user config file.
Types ¶
type Config ¶
type Config struct { AccessKeyID string `yaml:"qy_access_key_id"` SecretAccessKey string `yaml:"qy_secret_access_key"` Host string `yaml:"host"` Port int `yaml:"port"` Protocol string `yaml:"protocol"` URI string `yaml:"uri"` ConnectionRetries int `yaml:"connection_retries"` ConnectionTimeout int `yaml:"connection_timeout"` JSONDisableUnknownFields bool `yaml:"json_disable_unknown_fields"` LogLevel string `yaml:"log_level"` Zone string `yaml:"zone"` Connection *http.Client }
A Config stores a configuration of this sdk.
func LoadConfigFromContent ¶
LoadConfigFromContent loads configuration from a given byte slice. It returns error if yaml decode failed.
func LoadConfigFromFilepath ¶
LoadConfigFromFilepath loads configuration from a specified local path. It returns error if file not found or yaml decode failed.
func LoadUserConfig ¶
LoadUserConfig loads user configuration in ~/.qingcloud/config.yaml for Config. It returns error if file not found.
func MustLoadUserConfig ¶
func MustLoadUserConfig() *Config
MustLoadUserConfig loads user configuration in ~/.qingcloud/config.yaml for Config. It panic if failed.
func NewDefault ¶
NewDefault loads the default configuration for Config.
func (*Config) LoadConfigFromContent ¶
LoadConfigFromContent loads configuration from a given byte slice. It returns error if yaml decode failed.
func (*Config) LoadConfigFromFilepath ¶
LoadConfigFromFilepath loads configuration from a specified local path. It returns error if file not found or yaml decode failed.
func (*Config) LoadDefaultConfig ¶
LoadDefaultConfig loads the default configuration for Config. It returns error if yaml decode failed.
func (*Config) LoadUserConfig ¶
LoadUserConfig loads user configuration in ~/.qingcloud/config.yaml for Config. It returns error if file not found.