config

package
v2.14.0 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NoneKey  = "none"
	DebugKey = "debug"
	InfoKey  = "info"
	WarnKey  = "warn"
	ErrorKey = "error"
)

Variables

This section is empty.

Functions

func GetAccountDBPath

func GetAccountDBPath(configType ConfigType) string

func GetAccountFilePath

func GetAccountFilePath(configType ConfigType) string

func GetApiHosts

func GetApiHosts(configType ConfigType) []string

func GetCredentials

func GetCredentials(configType ConfigType) auth.Credentials

func GetIoHosts

func GetIoHosts(configType ConfigType) []string

func GetRsHosts

func GetRsHosts(configType ConfigType) []string

func GetRsfHosts

func GetRsfHosts(configType ConfigType) []string

func GetUcHosts

func GetUcHosts(configType ConfigType) []string

func GetUpHosts

func GetUpHosts(configType ConfigType) []string

func LoadGlobalConfig added in v2.9.2

func LoadGlobalConfig(globalConfigPath string) *data.CodeError

func LoadUserConfig added in v2.9.2

func LoadUserConfig(userConfigPath string) *data.CodeError

Types

type Config

type Config struct {
	CmdId       string            `json:"-"` // 命令 Id
	Credentials *auth.Credentials `json:"-"`
	UseHttps    *data.Bool        `json:"use_https,omitempty"`
	Hosts       *Hosts            `json:"hosts,omitempty"`
	Log         *LogSetting       `json:"log"`
}

func GetGlobal

func GetGlobal() *Config

func GetUser

func GetUser() *Config

func NewConfigWithPath

func NewConfigWithPath(path string) (*Config, *data.CodeError)

func (*Config) GetRegion

func (c *Config) GetRegion() *storage.Region

func (*Config) HasCredentials

func (c *Config) HasCredentials() bool

func (*Config) IsUseHttps

func (c *Config) IsUseHttps() bool

func (*Config) Merge

func (c *Config) Merge(from *Config)

func (*Config) String

func (c *Config) String() string

func (*Config) UpdateToLocal

func (c *Config) UpdateToLocal(path string) *data.CodeError

type ConfigType

type ConfigType int8
const (
	ConfigTypeDefault ConfigType = 1
	ConfigTypeUser    ConfigType = 2
	ConfigTypeGlobal  ConfigType = 3
)

type Hosts

type Hosts struct {
	UC  []string `json:"uc,omitempty"`
	Api []string `json:"api,omitempty"`
	Rs  []string `json:"rs,omitempty"`
	Rsf []string `json:"rsf,omitempty"`
	Io  []string `json:"io,omitempty"`
	Up  []string `json:"up,omitempty"`
}

func (*Hosts) GetOneApi

func (h *Hosts) GetOneApi() string

func (*Hosts) GetOneIo

func (h *Hosts) GetOneIo() string

func (*Hosts) GetOneRs

func (h *Hosts) GetOneRs() string

func (*Hosts) GetOneRsf

func (h *Hosts) GetOneRsf() string

func (*Hosts) GetOneUc

func (h *Hosts) GetOneUc() string

func (*Hosts) GetOneUp

func (h *Hosts) GetOneUp() string

type LoadInfo

type LoadInfo struct {
	UserConfigPath   string
	GlobalConfigPath string
}

type LogSetting

type LogSetting struct {
	LogLevel  *data.String `json:"log_level,omitempty"`
	LogFile   *data.String `json:"log_file,omitempty"`
	LogRotate *data.Int    `json:"log_rotate,omitempty"`
	LogStdout *data.Bool   `json:"log_stdout,omitempty"`
}

func (*LogSetting) Check

func (l *LogSetting) Check() *data.CodeError

func (*LogSetting) Enable

func (l *LogSetting) Enable() bool

func (*LogSetting) GetLogLevel

func (l *LogSetting) GetLogLevel() (logLevel int)

func (*LogSetting) IsLogStdout

func (l *LogSetting) IsLogStdout() bool

type Retry

type Retry struct {
	Max      *data.Int `json:"max,omitempty"`
	Interval *data.Int `json:"interval,omitempty"`
}

type Tasks

type Tasks struct {
	ConcurrentCount       *data.Int  `json:"concurrent_count,omitempty"`
	StopWhenOneTaskFailed *data.Bool `json:"stop_when_one_task_failed,omitempty"`
}

Jump to

Keyboard shortcuts

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