config

package
v0.1.16 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2024 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PID_RPA_EMPLOYEE RPA员工端信息管理平台
	PID_EMPLOYEE = "rpa-employee"
	// PID_BACKEND RPA员工端后台
	PID_BACKEND = "rpa-backend"
	// PID_DEV 开发平台
	PID_DEV = "rpa-devops"
	// PID_EMPLOYEE_DEVICE 员工端设备
	PID_EMPLOYEE_DEVICE = "emp-device"
	// PID_CUSTOMER 客户端
	PID_CUSTOMER = "customer"
)
View Source
const (
	// APPID_ZMROBOT RPA员工端信息管理平台
	APPID_ZMROBOT = "zmrobot"
	// APPID_COMP_MANAGER RPA员工端信息管理平台
	APPID_COMP_MANAGER = "company"
	// APPID_DEVOPS 运维开发系统
	APPID_DEVOPS = "devops"
)

Variables

View Source
var DefaultConfig = CoreConfig{
	MainConf: MainConfig{
		HttpAddr:    ":8080",
		OpenDocsAPI: true,
		Env:         "dev",
	},
	LogsConf: LogsConfig{
		"main": []LogConfig{
			{Level: zapcore.InfoLevel},
		},
		"access": []LogConfig{
			{Level: zapcore.InfoLevel},
		},
	},
}

DefaultConfig 默认配置

Functions

func GetApplicationName

func GetApplicationName(appid string) string

GetApplicationName 获取应用名称

func GetPlatformName

func GetPlatformName(pid string) string

GetPlatformName 获取平台名称

func IsValidPlatform

func IsValidPlatform(pid string) bool

IsValidPlatform 判断平台是否有效

func LoadYamlLocalFile

func LoadYamlLocalFile(file string, cfg interface{}) error

LoadYamlLocalFile .

func LoadYamlReader

func LoadYamlReader(r io.Reader, cfg interface{}) error

LoadYamlReader .

Types

type AliConfig

type AliConfig struct {
	RegionID        string `yaml:"region_id"`
	Endpoint        string `yaml:"endpoint"`
	AccessKeyID     string `yaml:"access_key_id"`
	AccessKeySecret string `yaml:"access_key_secret"`
}

type AliOSSConfig

type AliOSSConfig struct {
	AliConfig
	Bucket string `yaml:"bucket"`
}

AliOSSConfig .

type AliyunSLSConfig

type AliyunSLSConfig struct {
	AliConfig

	Project  string `yaml:"project"`
	Logstore string `yaml:"logstore"`
}

AliyunSLSConfig 阿里云日志服务配置

type ChatGPTConfig

type ChatGPTConfig struct {
	Token      string            `yaml:"token"`
	TokenName  string            `yaml:"token_name"`
	Tokens     map[string]string `yaml:"tokens"`
	HTTPClient HTTPClientConfig  `yaml:"http_client"`
}

type CoreConfig added in v0.1.7

type CoreConfig struct {
	MainConf MainConfig `yaml:"main"`
	LogsConf LogsConfig `yaml:"logger"`
}

Config 。

func Conf

func Conf() *CoreConfig

Conf .

func LoadCoreConfigFromFile added in v0.1.7

func LoadCoreConfigFromFile(filepath string) (*CoreConfig, error)

LoadCoreConfigFromFile .

type FilePurpose

type FilePurpose string
const (
	FilePurposeUnknown FilePurpose = "unknown"
	// FilePurposeAvatar 用户头像
	FilePurposeAvatar FilePurpose = "avatar"
	// FilePurposeFlightVideo 飞行视频
	FilePurposeFlightVideo FilePurpose = "flight_video"

	// FilePurposeOcrForm 用户端健康记录ocr单据
	FilePurposeOcrForm FilePurpose = "ocr_form"
	// FilePurposeForm 用户端健康记录上手上传单据文件
	FilePurposeForm FilePurpose = "form"

	// FilePurposeGeneral 通用的存储
	FilePurposeGeneral FilePurpose = "general"
)

type HTTPClientConfig

type HTTPClientConfig struct {
	Proxy *ProxyConfig `yaml:"proxy"`
}

type JwtConfig

type JwtConfig struct {
	// Secret jwt secret
	Secret string `yaml:"secret"`
	// Expire jwt expire time
	Expire time.Duration `yaml:"expire"`
}

JwtConfig jwt config

type LocalStorageConfig

type LocalStorageConfig struct {
	Dir string `yaml:"dir"`
	// PublicPrefix 公开访问的前缀
	PublicPrefix string `yaml:"public_prefix"`
}

LocalStorageConfig 。

type LogConfig

type LogConfig struct {
	// Writer 日志输出位置 console/file/workwx
	Writer string `yaml:"writer"`
	// Encoder 编码格式
	Encoder            string            `yaml:"encoder"`
	Level              zapcore.Level     `yaml:"level"`
	Key                string            `yaml:"key,omitempty"`
	AliyunSLS          *AliyunSLSConfig  `yaml:"aliyun_sls,omitempty"`
	TencentCLS         *TencentCLSConfig `yaml:"tencent_cls,omitempty"`
	*lumberjack.Logger `yaml:",inline"`
}

LogConfig 。

type LogsConfig

type LogsConfig map[string][]LogConfig

LogsConfig 。

func (LogsConfig) Default

func (c LogsConfig) Default() []LogConfig

Default 获取默认日志配置

func (LogsConfig) Get

func (c LogsConfig) Get(name string) []LogConfig

Get 获取日志配置

type MainConfig

type MainConfig struct {
	App         string            `yaml:"app"`
	HttpAddr    string            `yaml:"http_addr"`
	GrpcAddr    string            `yaml:"grpc_addr"`
	OpenDocsAPI bool              `yaml:"open_docs_api"`
	MysqlConns  map[string]string `yaml:"mysql_conns"`
	Env         string            `yaml:"env"`
}

MainConfig 住配置

type NotifyConfig

type NotifyConfig struct {
	// SMTP 发邮件参数
	SMTPs     []*SMTPConfig `yaml:"smtps"`
	WecomApps WecomApps     `yaml:"wecom_apps"`
}

func (NotifyConfig) WecomApp

func (c NotifyConfig) WecomApp(name string) WecomApp

WecomApp 企业微信应用

type ProxyConfig

type ProxyConfig struct {
	Scheme   string `yaml:"scheme"`
	Addr     string `yaml:"addr"`
	Username string `yaml:"username"`
	Password string `yaml:"password"`
}

type SMSConfig

type SMSConfig struct {
	// Aliyun 阿里云短信
	Aliyun       *AliConfig     `yaml:"aliyun"`
	Tencent      *TencentConfig `yaml:"tencent"`
	SignName     string         `yaml:"sign_name"`
	TemplateCode string         `yaml:"template_code"`
}

type SMTPConfig

type SMTPConfig struct {
	Name     string `yaml:"name"`
	Addr     string `yaml:"addr"`
	Username string `yaml:"username"`
	Password string `yaml:"password"`
	Nickname string `yaml:"nickname"`
}

SMTPConfig 发邮件参数

type StorageConfig

type StorageConfig struct {
	StorageOption `yaml:",inline"`

	Local   *LocalStorageConfig `yaml:"local,omitempty"`
	AliOSS  *AliOSSConfig       `yaml:"alioss,omitempty"`
	UpYun   *UpYunConfig        `yaml:"upyun,omitempty"`
	Tencent *TencentCOSConfig   `yaml:"tencent,omitempty"`
}

type StorageOption

type StorageOption struct {
	Purpose FilePurpose `yaml:"purpose"`
}

type TencentCLSConfig added in v0.1.3

type TencentCLSConfig struct {
	TencentConfig

	TopicID string `yaml:"topic_id"`
}

TencentCLSConfig 腾讯云日志服务配置

type TencentCOSConfig

type TencentCOSConfig struct {
	TencentConfig `yaml:",inline"`
	Bucket        string `yaml:"bucket"`
}

TencentCOSConfig 腾讯云对象存储配置

type TencentConfig

type TencentConfig struct {
	SecretID  string `yaml:"secret_id"`
	SecretKey string `yaml:"secret_key"`
	Region    string `yaml:"region"`
	Endpoint  string `yaml:"endpoint"`
}

TencentConfig 腾讯云配置

type UpYunConfig

type UpYunConfig struct {
	Bucket   string `yaml:"bucket"`
	Operator string `yaml:"operator"`
	Password string `yaml:"password"`
}

UpYunConfig .

type WecomApp

type WecomApp struct {
	Name           string `json:"name" yaml:"name"`
	CompanyID      string `json:"company_id" yaml:"company_id"`
	AgentID        int64  `json:"agent_id" yaml:"agent_id"`
	Secret         string `json:"secret" yaml:"secret"`
	Token          string `json:"token" yaml:"token"`
	EncodingAESKey string `json:"encoding_aes_key" yaml:"encoding_aes_key"`
}

WecomApp 企业微信应用

func (WecomApp) AESKey

func (cs WecomApp) AESKey() []byte

func (WecomApp) IsValide

func (c WecomApp) IsValide() bool

IsValide 是否有效

type WecomApps

type WecomApps []WecomApp

WecomApps 企业微信应用列表

type WecomConfig

type WecomConfig struct {
	Apps WecomApps `yaml:"apps"`
}

func (WecomConfig) WecomApp

func (c WecomConfig) WecomApp(name string) WecomApp

WecomApp 企业微信应用

Jump to

Keyboard shortcuts

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