config

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2026 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

config 包提供 Leros 的配置加载和配置类型定义

该包负责从配置文件加载各种配置项,包括 GitHub 应用配置、 GitLab 应用配置、NATS 消息队列配置和数据库配置等。

config 包提供 Leros 的配置加载和配置类型定义

该包负责从配置文件加载各种配置项,包括 GitHub 应用配置、 GitLab 应用配置、RabbitMQ 消息队列配置和数据库配置等。

config 包提供 Leros 的配置加载和配置类型定义

该包负责从配置文件加载各种配置项,包括 GitHub 应用配置、 GitLab 应用配置、RabbitMQ 消息队列配置和数据库配置等。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AliyunConfig added in v0.1.12

type AliyunConfig struct {
	AccessKeyID     string `yaml:"access_key_id,omitempty" json:"access_key_id,omitempty"`
	AccessKeySecret string `yaml:"access_key_secret,omitempty" json:"access_key_secret,omitempty"`
	SignName        string `yaml:"sign_name,omitempty" json:"sign_name,omitempty"`
	TemplateCode    string `yaml:"template_code,omitempty" json:"template_code,omitempty"`
	RegionID        string `yaml:"region_id,omitempty" json:"region_id,omitempty"`
	DefaultCode     string `yaml:"default_code,omitempty" json:"default_code,omitempty"`
}

AliyunConfig configures Aliyun SMS verification code delivery.

type CLIEnginesConfig

type CLIEnginesConfig struct {
	Default string     `yaml:"default,omitempty" json:"default,omitempty"`
	MCP     *MCPConfig `yaml:"mcp,omitempty" json:"mcp,omitempty"`
}

CLIEnginesConfig is the configuration for external AI coding CLIs.

type ClientUpdateConfig added in v0.1.13

type ClientUpdateConfig struct {
	Desktop ClientUpdatePolicy `yaml:"desktop,omitempty" json:"desktop,omitempty"`
	Web     ClientUpdatePolicy `yaml:"web,omitempty" json:"web,omitempty"`
}

ClientUpdateConfig configures client version compatibility policies.

type ClientUpdatePolicy added in v0.1.13

type ClientUpdatePolicy struct {
	MinSupportedVersion string `yaml:"min_supported_version,omitempty" json:"min_supported_version,omitempty"`
	LatestVersion       string `yaml:"latest_version,omitempty" json:"latest_version,omitempty"`
	UpdateURL           string `yaml:"update_url,omitempty" json:"update_url,omitempty"`
	ForceMessage        string `yaml:"force_message,omitempty" json:"force_message,omitempty"`
}

ClientUpdatePolicy describes update requirements for one client app.

type Config

type Config struct {
	Server struct {
		Port                  string    `yaml:"port,omitempty"`                    // 服务器端口
		DisableEventConsumers bool      `yaml:"disable_event_consumers,omitempty"` // 是否禁用后台事件消费者
		JWT                   JWTConfig `yaml:"jwt,omitempty"`                     // JWT 认证配置
	} `yaml:"server,omitempty"` // 服务器地址
	Env           string              `yaml:"env,omitempty"`
	WorkspaceRoot string              `yaml:"workspace_root,omitempty" json:"workspace_root,omitempty"`
	Log           LogConfig           `yaml:"log,omitempty" json:"log,omitempty"`
	NATS          *NATSConfig         `yaml:"nats,omitempty"`
	Database      *DatabaseConfig     `yaml:"database,omitempty"`
	LLM           *LLMConfig          `yaml:"llm,omitempty"`
	Scheduler     *SchedulerConfig    `yaml:"scheduler,omitempty"`
	Storage       *StorageConfig      `yaml:"storage,omitempty"`
	Gitea         *GiteaConfig        `yaml:"gitea,omitempty"`
	WorkerAuth    *WorkerAuthConfig   `yaml:"worker_auth,omitempty" json:"worker_auth,omitempty"`
	Aliyun        *AliyunConfig       `yaml:"aliyun,omitempty" json:"aliyun,omitempty"`
	ClientUpdate  *ClientUpdateConfig `yaml:"client_update,omitempty" json:"client_update,omitempty"`
	Feishu        *FeishuConfig       `yaml:"feishu,omitempty" json:"feishu,omitempty"`
}

Config 是 Leros 的主配置结构,包含所有子系统的配置

type DatabaseConfig

type DatabaseConfig struct {
	URL   string `yaml:"url,omitempty"`   // 数据库连接地址
	Debug bool   `yaml:"debug,omitempty"` // 是否启用调试模式
}

DatabaseConfig 是数据库的配置结构

type FeishuConfig added in v0.2.1

type FeishuConfig struct {
	Enabled   bool   `yaml:"enabled,omitempty" json:"enabled,omitempty"`
	AppID     string `yaml:"app_id,omitempty" json:"app_id,omitempty"`
	AppSecret string `yaml:"app_secret,omitempty" json:"app_secret,omitempty"`
	AppToken  string `yaml:"app_token,omitempty" json:"app_token,omitempty"`
	TableID   string `yaml:"table_id,omitempty" json:"table_id,omitempty"`
}

FeishuConfig configures Feishu Open Platform integration for feedback Bitable sync.

type GiteaConfig added in v0.1.14

type GiteaConfig struct {
	Enabled     bool   `yaml:"enabled"`
	Endpoint    string `yaml:"endpoint"`
	AccessToken string `yaml:"access_token"`
	Owner       string `yaml:"owner"`
}

GiteaConfig 外部 gitea 实例连接配置

type GithubAppConfig

type GithubAppConfig struct {
	AppID             int64    `yaml:"app_id"`              // GitHub 应用 ID
	PrivateKey        string   `yaml:"private_key"`         // GitHub 应用私钥
	WebhookSecret     string   `yaml:"webhook_secret"`      // Webhook 签名密钥
	BaseURL           string   `yaml:"base_url"`            // GitHub API 基础地址
	ClientID          string   `yaml:"client_id"`           // OAuth 客户端 ID
	ClientSecret      string   `yaml:"client_secret"`       // OAuth 客户端密钥
	RedirectURL       string   `yaml:"redirect_url"`        // OAuth 回调地址
	OAuthScopes       []string `yaml:"oauth_scopes"`        // OAuth scope 列表
	SkipWebhookVerify bool     `yaml:"skip_webhook_verify"` // 跳过webhook签名验证(仅用于开发)
}

GithubAppConfig 是 GitHub 应用的配置结构

type GitlabAppConfig

type GitlabAppConfig struct {
	AppID         int64  `yaml:"app_id,omitempty"`         // GitLab 应用 ID
	PrivateKey    string `yaml:"private_key,omitempty"`    // GitLab 应用私钥
	WebhookSecret string `yaml:"webhook_secret,omitempty"` // Webhook 签名密钥
	BaseURL       string `yaml:"base_url,omitempty"`       // GitLab API 基础地址
}

GitlabAppConfig 是 GitLab 应用的配置结构

type JWTConfig

type JWTConfig struct {
	Secret string `yaml:"secret,omitempty"` // JWT 签名密钥
}

JWTConfig JWT 认证配置

type LLMConfig

type LLMConfig struct {
	Provider    string                `yaml:"provider"`              // LLM Provider (openai, anthropic, etc.)
	APIKey      string                `yaml:"api_key"`               // API Key
	Model       string                `yaml:"model,omitempty"`       // Default model
	BaseURL     string                `yaml:"base_url,omitempty"`    // Custom base URL
	Translation *LLMTranslationConfig `yaml:"translation,omitempty"` // Built-in translation model
}

LLMConfig is the configuration structure for LLM providers

type LLMTranslationConfig added in v0.1.13

type LLMTranslationConfig struct {
	Provider string `yaml:"provider,omitempty"` // LLM Provider for translation
	APIKey   string `yaml:"api_key,omitempty"`  // API Key for translation
	Model    string `yaml:"model,omitempty"`    // Translation model
	BaseURL  string `yaml:"base_url,omitempty"` // Translation base URL
}

LLMTranslationConfig configures the built-in fast translation model.

type LogConfig added in v0.1.21

type LogConfig struct {
	Level string `yaml:"level,omitempty" json:"level,omitempty"`
}

LogConfig configures application logging.

type MCPConfig

type MCPConfig struct {
	URL         string `yaml:"url,omitempty" json:"url,omitempty"`
	BearerToken string `yaml:"bearer_token,omitempty" json:"bearer_token,omitempty"`
}

MCPConfig is the configuration for MCP server registration with external CLI tools.

type NATSConfig

type NATSConfig struct {
	URL string `yaml:"url,omitempty" json:"url,omitempty"` // NATS 服务地址
}

NATSConfig 是 NATS 消息队列的配置结构

type SchedulerConfig

type SchedulerConfig struct {
	Mode                  string            `yaml:"mode,omitempty" json:"mode,omitempty"` // 调度模式,支持 "process","docker-cli","docker-api","k8s"
	WorkerBinary          string            `yaml:"worker_binary,omitempty" json:"worker_binary,omitempty"`
	WorkingDir            string            `yaml:"working_dir,omitempty" json:"working_dir,omitempty"`
	Env                   map[string]string `yaml:"env,omitempty" json:"env,omitempty"`
	ServerAddr            string            `yaml:"server_addr,omitempty" json:"server_addr,omitempty"`
	KubernetesConnection  string            `yaml:"kubernetes_connection,omitempty" json:"kubernetes_connection,omitempty"`
	KubeconfigPath        string            `yaml:"kubeconfig_path,omitempty" json:"kubeconfig_path,omitempty"`
	KubeconfigContext     string            `yaml:"kubeconfig_context,omitempty" json:"kubeconfig_context,omitempty"`
	Namespace             string            `yaml:"namespace,omitempty" json:"namespace,omitempty"`
	WorkerImage           string            `yaml:"worker_image,omitempty" json:"worker_image,omitempty"`
	WorkspaceInitImage    string            `yaml:"workspace_init_image,omitempty" json:"workspace_init_image,omitempty"`
	ConfigMap             string            `yaml:"config_map,omitempty" json:"config_map,omitempty"`
	Secret                string            `yaml:"secret,omitempty" json:"secret,omitempty"`
	ImagePullSecret       string            `yaml:"image_pull_secret,omitempty" json:"image_pull_secret,omitempty"`
	WorkspaceHostPathRoot string            `yaml:"workspace_host_path_root,omitempty" json:"workspace_host_path_root,omitempty"`
	WorkspaceMountRoot    string            `yaml:"workspace_mount_root,omitempty" json:"workspace_mount_root,omitempty"`
	StorageHostPath       string            `yaml:"storage_host_path,omitempty" json:"storage_host_path,omitempty"`
	StorageMountPath      string            `yaml:"storage_mount_path,omitempty" json:"storage_mount_path,omitempty"`
	NodeSelector          map[string]string `yaml:"node_selector,omitempty" json:"node_selector,omitempty"`
}

type StorageConfig added in v0.1.2

type StorageConfig struct {
	Driver     string `yaml:"driver"`
	Endpoint   string `yaml:"endpoint,omitempty"`
	AccessKey  string `yaml:"access_key,omitempty"`
	SecretKey  string `yaml:"secret_key,omitempty"`
	UseSSL     bool   `yaml:"use_ssl,omitempty"`
	Bucket     string `yaml:"bucket,omitempty"`
	BaseURL    string `yaml:"base_url,omitempty"`
	URLStyle   string `yaml:"url_style,omitempty"`
	LocalDir   string `yaml:"local_dir,omitempty"`
	SignSecret string `yaml:"sign_secret,omitempty"`
}

StorageConfig 是存储的配置结构

type WorkerAuthConfig added in v0.1.12

type WorkerAuthConfig struct {
	BootstrapTokens []WorkerBootstrapToken `yaml:"bootstrap_tokens,omitempty" json:"bootstrap_tokens,omitempty"`
	TokenTTLSeconds int                    `yaml:"token_ttl_seconds,omitempty" json:"token_ttl_seconds,omitempty"`
}

WorkerAuthConfig configures worker bootstrap-token based authentication.

type WorkerBootstrapToken added in v0.1.12

type WorkerBootstrapToken struct {
	OrgID    uint   `yaml:"org_id" json:"org_id"`
	WorkerID uint   `yaml:"worker_id" json:"worker_id"`
	Token    string `yaml:"token" json:"token"`
}

WorkerBootstrapToken binds a bootstrap token to one worker/AI teammate identity.

type WorkerConfig

type WorkerConfig struct {
	OrgID    uint `yaml:"org_id" json:"org_id"`
	WorkerID uint `yaml:"worker_id" json:"worker_id"`

	ServerAddr     string `yaml:"server_addr,omitempty" json:"server_addr,omitempty"`
	AuthToken      string `yaml:"auth_token,omitempty" json:"auth_token,omitempty"`
	BootstrapToken string `yaml:"bootstrap_token,omitempty" json:"bootstrap_token,omitempty"`
	WorkspaceRoot  string `yaml:"workspace_root,omitempty" json:"workspace_root,omitempty"`

	Env   string            `yaml:"env,omitempty" json:"env,omitempty"`
	Log   LogConfig         `yaml:"log,omitempty" json:"log,omitempty"`
	NATS  *NATSConfig       `yaml:"nats,omitempty"`
	CLI   *CLIEnginesConfig `yaml:"cli,omitempty"`
	Gitea *GiteaConfig      `yaml:"gitea,omitempty"`
}

Jump to

Keyboard shortcuts

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