config

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Config *configModel
)

Functions

func GetAuthConfig

func GetAuthConfig() authConfig

GetAuthConfig 获取认证配置

func GetDatabaseType

func GetDatabaseType() string

GetDatabaseType 获取数据库类型

func GetExternalURL

func GetExternalURL() string

GetExternalURL 获取外部访问 URL GetExternalURL returns the external URL for accessing the Control Plane

func GetGRPCPort

func GetGRPCPort() int

GetGRPCPort 获取 gRPC 端口 GetGRPCPort returns the gRPC server port

func GetMaxPackageSize

func GetMaxPackageSize() int64

GetMaxPackageSize 获取最大安装包大小(字节)

func GetPackagesDir

func GetPackagesDir() string

GetPackagesDir 获取安装包存储目录

func GetPluginsDir

func GetPluginsDir() string

GetPluginsDir 获取插件存储目录

func GetSQLitePath

func GetSQLitePath() string

GetSQLitePath 获取 SQLite 文件路径

func GetTempDir

func GetTempDir() string

GetTempDir 获取临时文件目录

func IsGRPCEnabled

func IsGRPCEnabled() bool

IsGRPCEnabled 检查 gRPC 是否启用 IsGRPCEnabled checks if gRPC server is enabled

func ServerConfigError

func ServerConfigError() error

ServerConfigError 返回服务端配置加载或校验错误,CLI 本地命令不受该错误影响。 ServerConfigError returns the server configuration loading or validation error without blocking local CLI commands.

Types

type AppConfig

type AppConfig struct {
	AppName           string `mapstructure:"app_name"`
	Env               string `mapstructure:"env"`
	Addr              string `mapstructure:"addr"`
	APIPrefix         string `mapstructure:"api_prefix"`
	SessionCookieName string `mapstructure:"session_cookie_name"`
	SessionSecret     string `mapstructure:"session_secret"`
	SessionDomain     string `mapstructure:"session_domain"`
	SessionAge        int    `mapstructure:"session_age"`
	SessionHttpOnly   bool   `mapstructure:"session_http_only"`
	SessionSecure     bool   `mapstructure:"session_secure"`

	// ExternalURL is the external URL for accessing the Control Plane.
	// ExternalURL 是访问 Control Plane 的外部 URL。
	// This is used for generating Agent install commands and other external references.
	// 用于生成 Agent 安装命令和其他外部引用。
	// Example: "http://192.168.1.100:17800" or "https://stx.example.com"
	// 示例: "http://192.168.1.100:17800" 或 "https://stx.example.com"
	ExternalURL string `mapstructure:"external_url"`
}

AppConfig 应用基本配置(导出供其他包使用) AppConfig holds basic application configuration (exported for other packages)

type DatabaseConfig

type DatabaseConfig struct {
	Enabled         bool   `mapstructure:"enabled"`
	Type            string `mapstructure:"type"`        // sqlite, mysql, postgres
	SQLitePath      string `mapstructure:"sqlite_path"` // SQLite 文件路径
	Host            string `mapstructure:"host"`
	Port            int    `mapstructure:"port"`
	Username        string `mapstructure:"username"`
	Password        string `mapstructure:"password"`
	Database        string `mapstructure:"database"`
	MaxIdleConn     int    `mapstructure:"max_idle_conn"`
	MaxOpenConn     int    `mapstructure:"max_open_conn"`
	ConnMaxLifetime int    `mapstructure:"conn_max_lifetime"`
	LogLevel        string `mapstructure:"log_level"`
}

DatabaseConfig 数据库配置(导出供其他包使用)

type GRPCConfig

type GRPCConfig struct {
	// Enabled indicates whether gRPC server is enabled
	// Enabled 表示是否启用 gRPC 服务器
	Enabled bool `mapstructure:"enabled"`

	// Port is the port number for the gRPC server (default: 17890)
	// Port 是 gRPC 服务器的端口号(默认:17890)
	Port int `mapstructure:"port"`

	// TLSEnabled indicates whether TLS is enabled
	// TLSEnabled 表示是否启用 TLS
	TLSEnabled bool `mapstructure:"tls_enabled"`

	// CertFile is the path to the TLS certificate file
	// CertFile 是 TLS 证书文件的路径
	CertFile string `mapstructure:"cert_file"`

	// KeyFile is the path to the TLS key file
	// KeyFile 是 TLS 密钥文件的路径
	KeyFile string `mapstructure:"key_file"`

	// CAFile is the path to the CA certificate file for client verification
	// CAFile 是用于客户端验证的 CA 证书文件路径
	CAFile string `mapstructure:"ca_file"`

	// MaxRecvMsgSize is the maximum receive message size in MB (default: 16)
	// MaxRecvMsgSize 是最大接收消息大小(MB,默认:16)
	MaxRecvMsgSize int `mapstructure:"max_recv_msg_size"`

	// MaxSendMsgSize is the maximum send message size in MB (default: 16)
	// MaxSendMsgSize 是最大发送消息大小(MB,默认:16)
	MaxSendMsgSize int `mapstructure:"max_send_msg_size"`

	// HeartbeatInterval is the heartbeat interval to send to Agents (seconds, default: 10)
	// HeartbeatInterval 是发送给 Agent 的心跳间隔(秒,默认:10)
	HeartbeatInterval int `mapstructure:"heartbeat_interval"`

	// HeartbeatTimeout is the timeout for considering an Agent offline (seconds, default: 30)
	// HeartbeatTimeout 是判断 Agent 离线的超时时间(秒,默认:30)
	HeartbeatTimeout int `mapstructure:"heartbeat_timeout"`
}

GRPCConfig gRPC 服务器配置 GRPCConfig holds configuration for the gRPC server

func GetGRPCConfig

func GetGRPCConfig() GRPCConfig

GetGRPCConfig 获取 gRPC 配置 GetGRPCConfig returns the gRPC configuration

type OAuth2Config

type OAuth2Config struct {
	ClientID              string `mapstructure:"client_id"`
	ClientSecret          string `mapstructure:"client_secret"`
	RedirectURI           string `mapstructure:"redirect_uri"`
	AuthorizationEndpoint string `mapstructure:"authorization_endpoint"`
	TokenEndpoint         string `mapstructure:"token_endpoint"`
	UserEndpoint          string `mapstructure:"user_endpoint"`
}

OAuth2Config OAuth2认证配置(保留用于兼容旧配置)

type OAuthProviderConfig

type OAuthProviderConfig struct {
	Enabled      bool   `mapstructure:"enabled"`
	ClientID     string `mapstructure:"client_id"`
	ClientSecret string `mapstructure:"client_secret"`
	RedirectURI  string `mapstructure:"redirect_uri"`
}

OAuthProviderConfig 单个 OAuth 提供商配置

type OAuthProvidersConfig

type OAuthProvidersConfig struct {
	GitHub OAuthProviderConfig `mapstructure:"github"`
	Google OAuthProviderConfig `mapstructure:"google"`
}

OAuthProvidersConfig 多 OAuth 提供商配置

type ObservabilityAlertmanagerConfig

type ObservabilityAlertmanagerConfig struct {
	URL string `mapstructure:"url"`

	// WebhookPath is the fixed Alertmanager webhook path exposed by STX.
	// WebhookPath 是 STX 暴露的 Alertmanager Webhook 路径。
	WebhookPath string `mapstructure:"webhook_path"`
}

ObservabilityAlertmanagerConfig Alertmanager 集成配置

type ObservabilityConfig

type ObservabilityConfig struct {
	// Enabled indicates whether observability integration is enabled.
	// Enabled 表示是否启用可观测性集成。
	Enabled bool `mapstructure:"enabled"`

	Prometheus      ObservabilityPrometheusConfig      `mapstructure:"prometheus"`
	Alertmanager    ObservabilityAlertmanagerConfig    `mapstructure:"alertmanager"`
	Grafana         ObservabilityGrafanaConfig         `mapstructure:"grafana"`
	SeatunnelMetric ObservabilitySeatunnelMetricConfig `mapstructure:"seatunnel_metrics"`
}

ObservabilityConfig 可观测性配置(Prometheus/Grafana/Alertmanager 集成)

type ObservabilityGrafanaConfig

type ObservabilityGrafanaConfig struct {
	URL string `mapstructure:"url"`
}

ObservabilityGrafanaConfig Grafana 集成配置

type ObservabilityPrometheusConfig

type ObservabilityPrometheusConfig struct {
	URL string `mapstructure:"url"`

	// HTTPSDPath is the fixed HTTP SD endpoint path exposed by STX.
	// HTTPSDPath 是 STX 暴露的 Prometheus HTTP SD 路径。
	HTTPSDPath string `mapstructure:"http_sd_path"`
}

ObservabilityPrometheusConfig Prometheus 集成配置

type ObservabilitySeatunnelMetricConfig

type ObservabilitySeatunnelMetricConfig struct {
	Path string `mapstructure:"path"`

	// ProbeTimeoutSeconds is the timeout for probing one metrics endpoint.
	// ProbeTimeoutSeconds 是单个 metrics 端点探测超时时间(秒)。
	ProbeTimeoutSeconds int `mapstructure:"probe_timeout_seconds"`
}

ObservabilitySeatunnelMetricConfig SeaTunnel metrics 探测配置

type StorageConfig

type StorageConfig struct {
	// BaseDir 基础存储目录,其他目录默认相对于此目录
	// BaseDir is the base storage directory, other directories are relative to this
	BaseDir string `mapstructure:"base_dir"`

	// PackagesDir SeaTunnel 安装包存储目录
	// PackagesDir is the directory for SeaTunnel installation packages
	PackagesDir string `mapstructure:"packages_dir"`

	// PluginsDir 插件包存储目录(connector jars, lib dependencies)
	// PluginsDir is the directory for plugin packages
	PluginsDir string `mapstructure:"plugins_dir"`

	// TempDir 临时文件目录(下载中的文件等)
	// TempDir is the directory for temporary files
	TempDir string `mapstructure:"temp_dir"`

	// MaxPackageSize 最大安装包大小(MB),默认 2048MB (2GB)
	// MaxPackageSize is the maximum package size in MB
	MaxPackageSize int64 `mapstructure:"max_package_size"`

	// CleanupIntervalHours 临时文件清理间隔(小时),默认 24
	// CleanupIntervalHours is the interval for cleaning up temp files
	CleanupIntervalHours int `mapstructure:"cleanup_interval_hours"`
}

StorageConfig 存储配置(本地文件存储目录)

func GetStorageConfig

func GetStorageConfig() StorageConfig

GetStorageConfig 获取存储配置

type SyncConfig

type SyncConfig struct {
	// PreviewDataTTLMinutes controls how long preview session data is retained.
	// PreviewDataTTLMinutes 控制预览会话数据的保留时长(分钟)。
	PreviewDataTTLMinutes int `mapstructure:"preview_data_ttl_minutes"`
	// PreviewDataTTLHours is kept for backward compatibility and will be used when minute-level config is absent.
	// PreviewDataTTLHours 仅用于兼容旧配置;未设置分钟级配置时才会使用。
	PreviewDataTTLHours int `mapstructure:"preview_data_ttl_hours"`
}

SyncConfig 同步工作台相关配置。 SyncConfig holds sync studio related settings.

type TelemetryConfig

type TelemetryConfig struct {
	// Enabled indicates whether OpenTelemetry tracing is enabled
	// Enabled 表示是否启用 OpenTelemetry 追踪
	Enabled bool `mapstructure:"enabled"`

	// Endpoint is the OTLP collector endpoint (default: localhost:4317)
	// Endpoint 是 OTLP 收集器端点(默认:localhost:4317)
	Endpoint string `mapstructure:"endpoint"`
}

TelemetryConfig 遥测配置 TelemetryConfig holds telemetry/tracing configuration

Jump to

Keyboard shortcuts

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