config

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetGlobalConfig

func SetGlobalConfig(cfg *Config)

SetGlobalConfig 设置全局配置

Types

type AuthConfig

type AuthConfig struct {
	Enabled bool     `mapstructure:"enabled"`
	Type    string   `mapstructure:"type"` // token, basic, oauth2
	Tokens  []string `mapstructure:"tokens"`
}

AuthConfig 认证配置

type CICDConfig

type CICDConfig struct {
	Jenkins JenkinsConfig `mapstructure:"jenkins"`
}

CICDConfig CI/CD 工具配置

type CacheConfig

type CacheConfig struct {
	Enabled bool   `mapstructure:"enabled"`
	Type    string `mapstructure:"type"` // memory, redis
	TTL     int    `mapstructure:"ttl"`  // 秒
}

CacheConfig 缓存配置

type Config

type Config struct {
	Server    ServerConfig    `mapstructure:"server"`
	Providers ProvidersConfig `mapstructure:"providers"`
	CICD      CICDConfig      `mapstructure:"cicd"`
	DingTalk  DingTalkConfig  `mapstructure:"dingtalk"`
	Feishu    FeishuConfig    `mapstructure:"feishu"`
	Wecom     WecomConfig     `mapstructure:"wecom"`
	LLM       LLMConfig       `mapstructure:"llm"`
	Auth      AuthConfig      `mapstructure:"auth"`
	Cache     CacheConfig     `mapstructure:"cache"`
}

Config 应用配置

func GetGlobalConfig

func GetGlobalConfig() *Config

GetGlobalConfig 获取全局配置

func LoadConfig

func LoadConfig(configFile string) (*Config, error)

LoadConfig 加载配置文件

type DingTalkConfig

type DingTalkConfig struct {
	Enabled        bool   `mapstructure:"enabled"`
	AppKey         string `mapstructure:"app_key"`
	AppSecret      string `mapstructure:"app_secret"`
	AgentID        string `mapstructure:"agent_id"`
	CardTemplateID string `mapstructure:"card_template_id"` // AI 流式卡片模板 ID
}

DingTalkConfig 钉钉配置

type FeishuConfig added in v0.1.2

type FeishuConfig struct {
	Enabled   bool   `mapstructure:"enabled"`
	AppID     string `mapstructure:"app_id"`
	AppSecret string `mapstructure:"app_secret"`
}

FeishuConfig 飞书配置

type HTTPConfig

type HTTPConfig struct {
	Enabled bool `mapstructure:"enabled"`
	Port    int  `mapstructure:"port"`
	Debug   bool `mapstructure:"debug"` // Gin Debug 模式
}

HTTPConfig HTTP 服务配置

type JenkinsConfig

type JenkinsConfig struct {
	Enabled  bool   `mapstructure:"enabled"`
	URL      string `mapstructure:"url"`
	Username string `mapstructure:"username"`
	Token    string `mapstructure:"token"`
}

JenkinsConfig Jenkins 配置

type LLMConfig

type LLMConfig struct {
	Enabled bool   `mapstructure:"enabled"`
	Model   string `mapstructure:"model"`
	APIKey  string `mapstructure:"api_key"`
	BaseURL string `mapstructure:"base_url"` // 自定义 API 端点
}

LLMConfig LLM 配置

type MCPConfig

type MCPConfig struct {
	Enabled bool `mapstructure:"enabled"`
	Port    int  `mapstructure:"port"`
}

MCPConfig MCP 服务配置

type ProviderConfig

type ProviderConfig struct {
	Name    string            `mapstructure:"name"` // 账号名称,用于区分多个账号
	Enabled bool              `mapstructure:"enabled"`
	AK      string            `mapstructure:"ak"`
	SK      string            `mapstructure:"sk"`
	Regions []string          `mapstructure:"regions"`
	Extra   map[string]string `mapstructure:"extra"`
}

ProviderConfig 云服务提供商配置

type ProvidersConfig

type ProvidersConfig struct {
	Aliyun  []ProviderConfig `mapstructure:"aliyun"`
	Tencent []ProviderConfig `mapstructure:"tencent"`
}

ProvidersConfig 云服务提供商配置集合

type ServerConfig

type ServerConfig struct {
	HTTP HTTPConfig `mapstructure:"http"`
	MCP  MCPConfig  `mapstructure:"mcp"`
}

ServerConfig 服务器配置

type WecomConfig added in v0.1.2

type WecomConfig struct {
	Enabled        bool   `mapstructure:"enabled"`
	Token          string `mapstructure:"token"`            // 企业微信AI机器人Token
	EncodingAESKey string `mapstructure:"encoding_aes_key"` // 消息加密密钥
}

WecomConfig 企业微信配置

Jump to

Keyboard shortcuts

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