mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-06 07:36:37 +08:00
迁移配置表
This commit is contained in:
@@ -21,12 +21,10 @@ const (
|
||||
|
||||
// Shared GORM column name constants used across model package.
|
||||
const (
|
||||
colName = "name"
|
||||
colEnabled = "enabled"
|
||||
colRemark = "remark"
|
||||
tableOfProxyRoutes = "of_proxy_routes"
|
||||
optionKeyUptimeKumaPassword = "UptimeKumaPassword"
|
||||
optionValueTrue = "true"
|
||||
colName = "name"
|
||||
colEnabled = "enabled"
|
||||
colRemark = "remark"
|
||||
tableOfProxyRoutes = "of_proxy_routes"
|
||||
)
|
||||
|
||||
var authSourceNamePattern = regexp.MustCompile(`^[A-Za-z0-9][A-Za-z0-9_-]{0,79}$`)
|
||||
|
||||
@@ -3,105 +3,22 @@
|
||||
|
||||
package model
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
import "time"
|
||||
|
||||
"github.com/Rain-kl/Wavelet/internal/db"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
// OpenFlareOption stores a hot-reloadable OpenFlare system option.
|
||||
// OpenFlareOption is the key/value DTO used by the OpenFlare option API surface.
|
||||
// Key 与 w_system_configs.key 一致(snake_case)。此类型仅作为
|
||||
// /api/v1/d/option 接口的请求/响应载体,不再映射到独立的 of_options 表。
|
||||
type OpenFlareOption struct {
|
||||
Key string `json:"key" gorm:"column:key;primaryKey;size:128;not null"`
|
||||
Value string `json:"value" gorm:"type:text;not null"`
|
||||
Key string `json:"key"`
|
||||
Value string `json:"value"`
|
||||
}
|
||||
|
||||
// TableName returns the OpenFlare options table name.
|
||||
func (OpenFlareOption) TableName() string {
|
||||
return "of_options"
|
||||
}
|
||||
// StartTime records process start time (seconds) for the public /status endpoint.
|
||||
var StartTime = time.Now().Unix()
|
||||
|
||||
// OptionMap holds the in-memory option snapshot for fast reads and hot reload.
|
||||
var (
|
||||
OptionMap map[string]string
|
||||
OptionMapRWMutex sync.RWMutex
|
||||
|
||||
// StartTime records process start time (seconds) for legacy /api/status.
|
||||
StartTime = time.Now().Unix()
|
||||
|
||||
// Hot-reload mirrors for frequently read options (legacy OpenFlare keys).
|
||||
SystemName = "OpenFlare"
|
||||
ServerAddress = ""
|
||||
Footer = ""
|
||||
HomePageLink = ""
|
||||
PasswordLoginEnabled = true
|
||||
CapLoginEnabled = true
|
||||
PasswordRegisterEnabled = false
|
||||
EmailVerificationEnabled = false
|
||||
SMTPPort = 587
|
||||
AgentDiscoveryToken = ""
|
||||
AgentHeartbeatInterval = 10000
|
||||
AgentWebsocketUpgradeEnabled = true
|
||||
NodeOfflineThreshold = 2 * time.Minute
|
||||
AgentUpdateRepo = "Rain-kl/OpenFlare"
|
||||
GeoIPProvider = "ipinfo"
|
||||
DatabaseAutoCleanupEnabled = false
|
||||
DatabaseAutoCleanupRetentionDays = 30
|
||||
UptimeKumaEnabled = false
|
||||
UptimeKumaURL = ""
|
||||
UptimeKumaUsername = ""
|
||||
UptimeKumaPassword = ""
|
||||
UptimeKumaMonitorScope = "all"
|
||||
UptimeKumaSelectedSites = ""
|
||||
UptimeKumaSyncInterval = 5
|
||||
UptimeKumaInterval = 60
|
||||
UptimeKumaRetry = 0
|
||||
UptimeKumaRetryInterval = 60
|
||||
UptimeKumaTimeout = 48
|
||||
OpenRestyDefaultServerReturnStatus = 421
|
||||
OpenRestyWorkerProcesses = "auto"
|
||||
OpenRestyWorkerConnections = 4096
|
||||
OpenRestyWorkerRlimitNofile = 65535
|
||||
OpenRestyEventsUse = "epoll"
|
||||
OpenRestyEventsMultiAcceptEnabled = true
|
||||
OpenRestyKeepaliveTimeout = 20
|
||||
OpenRestyKeepaliveRequests = 1000
|
||||
OpenRestyClientHeaderTimeout = 15
|
||||
OpenRestyClientBodyTimeout = 15
|
||||
OpenRestyClientMaxBodySize = "64m"
|
||||
OpenRestyLargeClientHeaderBuffers = "4 16k"
|
||||
OpenRestySendTimeout = 30
|
||||
OpenRestyResolvers = ""
|
||||
OpenRestyProxyConnectTimeout = 3
|
||||
OpenRestyProxySendTimeout = 60
|
||||
OpenRestyProxyReadTimeout = 60
|
||||
OpenRestyWebsocketEnabled = true
|
||||
OpenRestyHTTP3Enabled = true
|
||||
OpenRestyProxyRequestBufferingEnabled = false
|
||||
OpenRestyProxyBufferingEnabled = true
|
||||
OpenRestyProxyBuffers = "16 16k"
|
||||
OpenRestyProxyBufferSize = "8k"
|
||||
OpenRestyProxyBusyBuffersSize = "64k"
|
||||
OpenRestyGzipEnabled = true
|
||||
OpenRestyGzipMinLength = 1024
|
||||
OpenRestyGzipCompLevel = 5
|
||||
OpenRestyCacheEnabled = false
|
||||
OpenRestyCachePath = ""
|
||||
OpenRestyCacheLevels = "1:2"
|
||||
OpenRestyCacheInactive = "30m"
|
||||
OpenRestyCacheMaxSize = "1g"
|
||||
OpenRestyCacheKeyTemplate = "$scheme$host$request_uri"
|
||||
OpenRestyCacheLockEnabled = true
|
||||
OpenRestyCacheLockTimeout = "5s"
|
||||
OpenRestyCacheUseStale = "error timeout updating http_500 http_502 http_503 http_504"
|
||||
OpenRestyMainConfigTemplate = defaultOpenRestyMainConfigTemplate
|
||||
)
|
||||
|
||||
const defaultOpenRestyMainConfigTemplate = `# This file is generated by OpenFlare. Do not edit manually.
|
||||
// DefaultOpenRestyMainConfigTemplate 是 OpenResty 主配置模板的内置默认值。
|
||||
// 当 SystemConfig 中缺失 openresty_main_config_template 时作为兜底使用。
|
||||
const DefaultOpenRestyMainConfigTemplate = `# This file is generated by OpenFlare. Do not edit manually.
|
||||
user openflare;
|
||||
worker_processes {{OpenRestyWorkerProcesses}};
|
||||
worker_rlimit_nofile {{OpenRestyWorkerRlimitNofile}};
|
||||
@@ -147,171 +64,3 @@ http {
|
||||
{{OpenRestyResolverDirective}}{{OpenRestyCacheBlock}} include {{OpenRestyRouteConfigInclude}};
|
||||
}
|
||||
`
|
||||
|
||||
// DefaultOpenFlareOptions returns built-in defaults keyed by legacy OpenFlare option names.
|
||||
func DefaultOpenFlareOptions() map[string]string {
|
||||
return map[string]string{
|
||||
"PasswordLoginEnabled": strconv.FormatBool(PasswordLoginEnabled),
|
||||
"CapLoginEnabled": strconv.FormatBool(CapLoginEnabled),
|
||||
"PasswordRegisterEnabled": strconv.FormatBool(PasswordRegisterEnabled),
|
||||
"EmailVerificationEnabled": strconv.FormatBool(EmailVerificationEnabled),
|
||||
"SMTPServer": "",
|
||||
"SMTPPort": strconv.Itoa(SMTPPort),
|
||||
"SMTPAccount": "",
|
||||
"SMTPToken": "",
|
||||
"About": "",
|
||||
"Footer": Footer,
|
||||
"HomePageLink": HomePageLink,
|
||||
"SystemName": SystemName,
|
||||
"ServerAddress": "",
|
||||
"AgentDiscoveryToken": "",
|
||||
"AgentHeartbeatInterval": strconv.Itoa(AgentHeartbeatInterval),
|
||||
"AgentWebsocketUpgradeEnabled": strconv.FormatBool(AgentWebsocketUpgradeEnabled),
|
||||
"NodeOfflineThreshold": strconv.Itoa(int(NodeOfflineThreshold.Milliseconds())),
|
||||
"AgentUpdateRepo": AgentUpdateRepo,
|
||||
"GeoIPProvider": GeoIPProvider,
|
||||
"DatabaseAutoCleanupEnabled": strconv.FormatBool(DatabaseAutoCleanupEnabled),
|
||||
"UptimeKumaEnabled": strconv.FormatBool(UptimeKumaEnabled),
|
||||
"UptimeKumaUrl": UptimeKumaURL,
|
||||
"UptimeKumaUsername": UptimeKumaUsername,
|
||||
optionKeyUptimeKumaPassword: UptimeKumaPassword,
|
||||
"UptimeKumaMonitorScope": UptimeKumaMonitorScope,
|
||||
"UptimeKumaSelectedSites": UptimeKumaSelectedSites,
|
||||
"UptimeKumaSyncInterval": strconv.Itoa(UptimeKumaSyncInterval),
|
||||
"UptimeKumaInterval": strconv.Itoa(UptimeKumaInterval),
|
||||
"UptimeKumaRetry": strconv.Itoa(UptimeKumaRetry),
|
||||
"UptimeKumaRetryInterval": strconv.Itoa(UptimeKumaRetryInterval),
|
||||
"UptimeKumaTimeout": strconv.Itoa(UptimeKumaTimeout),
|
||||
"DatabaseAutoCleanupRetentionDays": strconv.Itoa(DatabaseAutoCleanupRetentionDays),
|
||||
"OpenRestyDefaultServerReturnStatus": strconv.Itoa(OpenRestyDefaultServerReturnStatus),
|
||||
"OpenRestyWorkerProcesses": OpenRestyWorkerProcesses,
|
||||
"OpenRestyWorkerConnections": strconv.Itoa(OpenRestyWorkerConnections),
|
||||
"OpenRestyWorkerRlimitNofile": strconv.Itoa(OpenRestyWorkerRlimitNofile),
|
||||
"OpenRestyEventsUse": OpenRestyEventsUse,
|
||||
"OpenRestyEventsMultiAcceptEnabled": strconv.FormatBool(OpenRestyEventsMultiAcceptEnabled),
|
||||
"OpenRestyKeepaliveTimeout": strconv.Itoa(OpenRestyKeepaliveTimeout),
|
||||
"OpenRestyKeepaliveRequests": strconv.Itoa(OpenRestyKeepaliveRequests),
|
||||
"OpenRestyClientHeaderTimeout": strconv.Itoa(OpenRestyClientHeaderTimeout),
|
||||
"OpenRestyClientBodyTimeout": strconv.Itoa(OpenRestyClientBodyTimeout),
|
||||
"OpenRestyClientMaxBodySize": OpenRestyClientMaxBodySize,
|
||||
"OpenRestyLargeClientHeaderBuffers": OpenRestyLargeClientHeaderBuffers,
|
||||
"OpenRestySendTimeout": strconv.Itoa(OpenRestySendTimeout),
|
||||
"OpenRestyProxyConnectTimeout": strconv.Itoa(OpenRestyProxyConnectTimeout),
|
||||
"OpenRestyProxySendTimeout": strconv.Itoa(OpenRestyProxySendTimeout),
|
||||
"OpenRestyProxyReadTimeout": strconv.Itoa(OpenRestyProxyReadTimeout),
|
||||
"OpenRestyWebsocketEnabled": strconv.FormatBool(OpenRestyWebsocketEnabled),
|
||||
"OpenRestyHTTP3Enabled": strconv.FormatBool(OpenRestyHTTP3Enabled),
|
||||
"OpenRestyProxyRequestBufferingEnabled": strconv.FormatBool(OpenRestyProxyRequestBufferingEnabled),
|
||||
"OpenRestyProxyBufferingEnabled": strconv.FormatBool(OpenRestyProxyBufferingEnabled),
|
||||
"OpenRestyProxyBuffers": OpenRestyProxyBuffers,
|
||||
"OpenRestyProxyBufferSize": OpenRestyProxyBufferSize,
|
||||
"OpenRestyProxyBusyBuffersSize": OpenRestyProxyBusyBuffersSize,
|
||||
"OpenRestyGzipEnabled": strconv.FormatBool(OpenRestyGzipEnabled),
|
||||
"OpenRestyGzipMinLength": strconv.Itoa(OpenRestyGzipMinLength),
|
||||
"OpenRestyGzipCompLevel": strconv.Itoa(OpenRestyGzipCompLevel),
|
||||
"OpenRestyCacheEnabled": strconv.FormatBool(OpenRestyCacheEnabled),
|
||||
"OpenRestyCachePath": OpenRestyCachePath,
|
||||
"OpenRestyCacheLevels": OpenRestyCacheLevels,
|
||||
"OpenRestyCacheInactive": OpenRestyCacheInactive,
|
||||
"OpenRestyCacheMaxSize": OpenRestyCacheMaxSize,
|
||||
"OpenRestyCacheKeyTemplate": OpenRestyCacheKeyTemplate,
|
||||
"OpenRestyCacheLockEnabled": strconv.FormatBool(OpenRestyCacheLockEnabled),
|
||||
"OpenRestyCacheLockTimeout": OpenRestyCacheLockTimeout,
|
||||
"OpenRestyCacheUseStale": OpenRestyCacheUseStale,
|
||||
"OpenRestyMainConfigTemplate": OpenRestyMainConfigTemplate,
|
||||
}
|
||||
}
|
||||
|
||||
// InitOptionMap seeds defaults and overlays persisted options from of_options.
|
||||
func InitOptionMap(ctx context.Context) error {
|
||||
OptionMapRWMutex.Lock()
|
||||
OptionMap = DefaultOpenFlareOptions()
|
||||
OptionMapRWMutex.Unlock()
|
||||
|
||||
options, err := ListOpenFlareOptions(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for _, option := range options {
|
||||
applyOptionMap(option.Key, option.Value)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// ListOpenFlareOptions returns all persisted options.
|
||||
func ListOpenFlareOptions(ctx context.Context) ([]OpenFlareOption, error) {
|
||||
var options []OpenFlareOption
|
||||
if err := db.DB(ctx).Find(&options).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return options, nil
|
||||
}
|
||||
|
||||
// UpdateOpenFlareOption updates a single option in DB and memory.
|
||||
func UpdateOpenFlareOption(ctx context.Context, key, value string) error {
|
||||
return UpdateOpenFlareOptions(ctx, []OpenFlareOption{{Key: key, Value: value}})
|
||||
}
|
||||
|
||||
// UpdateOpenFlareOptions batch-updates options in a transaction and refreshes OptionMap.
|
||||
func UpdateOpenFlareOptions(ctx context.Context, options []OpenFlareOption) error {
|
||||
if len(options) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := db.DB(ctx).Transaction(func(tx *gorm.DB) error {
|
||||
for _, item := range options {
|
||||
if item.Key == optionKeyUptimeKumaPassword && strings.TrimSpace(item.Value) == "" {
|
||||
continue
|
||||
}
|
||||
option := OpenFlareOption{Key: item.Key}
|
||||
if err := tx.FirstOrCreate(&option, OpenFlareOption{Key: item.Key}).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
option.Value = item.Value
|
||||
if err := tx.Save(&option).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, item := range options {
|
||||
if item.Key == optionKeyUptimeKumaPassword && strings.TrimSpace(item.Value) == "" {
|
||||
continue
|
||||
}
|
||||
applyOptionMap(item.Key, item.Value)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// OptionValue returns a snapshot value from OptionMap.
|
||||
func OptionValue(key string) string {
|
||||
OptionMapRWMutex.RLock()
|
||||
defer OptionMapRWMutex.RUnlock()
|
||||
if OptionMap == nil {
|
||||
return ""
|
||||
}
|
||||
return OptionMap[key]
|
||||
}
|
||||
|
||||
// ResetOptionMapForTest clears in-memory option state for unit tests.
|
||||
func ResetOptionMapForTest() {
|
||||
OptionMapRWMutex.Lock()
|
||||
OptionMap = nil
|
||||
OptionMapRWMutex.Unlock()
|
||||
}
|
||||
|
||||
func applyOptionMap(key, value string) {
|
||||
OptionMapRWMutex.Lock()
|
||||
defer OptionMapRWMutex.Unlock()
|
||||
if OptionMap == nil {
|
||||
OptionMap = make(map[string]string)
|
||||
}
|
||||
OptionMap[key] = value
|
||||
applyEnabledOptionMirror(key, value)
|
||||
applyStringOptionMirror(key, value)
|
||||
applyIntegerOptionMirror(key, value)
|
||||
applySpecialOptionMirror(key, value)
|
||||
}
|
||||
|
||||
@@ -1,86 +0,0 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
var enabledOptionAppliers = map[string]func(bool){
|
||||
"PasswordRegisterEnabled": func(v bool) { PasswordRegisterEnabled = v },
|
||||
"PasswordLoginEnabled": func(v bool) { PasswordLoginEnabled = v },
|
||||
"CapLoginEnabled": func(v bool) { CapLoginEnabled = v },
|
||||
"EmailVerificationEnabled": func(v bool) { EmailVerificationEnabled = v },
|
||||
"AgentWebsocketUpgradeEnabled": func(v bool) { AgentWebsocketUpgradeEnabled = v },
|
||||
"UptimeKumaEnabled": func(v bool) { UptimeKumaEnabled = v },
|
||||
"DatabaseAutoCleanupEnabled": func(v bool) { DatabaseAutoCleanupEnabled = v },
|
||||
}
|
||||
|
||||
var stringOptionAppliers = map[string]func(string){
|
||||
"ServerAddress": func(v string) { ServerAddress = v },
|
||||
"Footer": func(v string) { Footer = v },
|
||||
"HomePageLink": func(v string) { HomePageLink = v },
|
||||
"SystemName": func(v string) { SystemName = v },
|
||||
"AgentDiscoveryToken": func(v string) { AgentDiscoveryToken = v },
|
||||
"GeoIPProvider": func(v string) { GeoIPProvider = v },
|
||||
"UptimeKumaUrl": func(v string) { UptimeKumaURL = v },
|
||||
"UptimeKumaUsername": func(v string) { UptimeKumaUsername = v },
|
||||
optionKeyUptimeKumaPassword: func(v string) { UptimeKumaPassword = v },
|
||||
"UptimeKumaMonitorScope": func(v string) { UptimeKumaMonitorScope = v },
|
||||
"UptimeKumaSelectedSites": func(v string) { UptimeKumaSelectedSites = v },
|
||||
}
|
||||
|
||||
func applyEnabledOptionMirror(key, value string) {
|
||||
applier, ok := enabledOptionAppliers[key]
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
applier(value == optionValueTrue)
|
||||
}
|
||||
|
||||
func applyStringOptionMirror(key, value string) {
|
||||
if applier, ok := stringOptionAppliers[key]; ok {
|
||||
applier(value)
|
||||
}
|
||||
}
|
||||
|
||||
type intOptionApplier struct {
|
||||
apply func(int)
|
||||
min int
|
||||
}
|
||||
|
||||
var integerOptionAppliers = map[string]intOptionApplier{
|
||||
"SMTPPort": {apply: func(v int) { SMTPPort = v }},
|
||||
"AgentHeartbeatInterval": {apply: func(v int) { AgentHeartbeatInterval = v }, min: 1},
|
||||
"UptimeKumaSyncInterval": {apply: func(v int) { UptimeKumaSyncInterval = v }, min: 1},
|
||||
"UptimeKumaInterval": {apply: func(v int) { UptimeKumaInterval = v }, min: 1},
|
||||
"UptimeKumaRetry": {apply: func(v int) { UptimeKumaRetry = v }, min: 0},
|
||||
"UptimeKumaRetryInterval": {apply: func(v int) { UptimeKumaRetryInterval = v }, min: 1},
|
||||
"UptimeKumaTimeout": {apply: func(v int) { UptimeKumaTimeout = v }, min: 1},
|
||||
"DatabaseAutoCleanupRetentionDays": {apply: func(v int) { DatabaseAutoCleanupRetentionDays = v }, min: 1},
|
||||
}
|
||||
|
||||
func applyIntegerOptionMirror(key, value string) {
|
||||
applier, ok := integerOptionAppliers[key]
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
intValue, err := strconv.Atoi(value)
|
||||
if err != nil || intValue < applier.min {
|
||||
return
|
||||
}
|
||||
applier.apply(intValue)
|
||||
}
|
||||
|
||||
func applySpecialOptionMirror(key, value string) {
|
||||
switch key {
|
||||
case "NodeOfflineThreshold":
|
||||
if v, err := strconv.Atoi(value); err == nil && v > 0 {
|
||||
NodeOfflineThreshold = time.Duration(v) * time.Millisecond
|
||||
}
|
||||
case "AgentUpdateRepo":
|
||||
if strings.TrimSpace(value) != "" {
|
||||
AgentUpdateRepo = value
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -37,8 +37,70 @@ const (
|
||||
ConfigKeyLoginSessionTTLHours = "login_session_ttl_hours" // 登录会话过期时间 (小时,0表示浏览器关闭后自动退出登录,-1表示永不过期)
|
||||
ConfigKeyUpdateUpstreamRepository = "update_upstream_repository" // GitHub Actions Release 上游仓库
|
||||
ConfigKeyStorageConfig = "storage_config" // 文件存储配置 (JSON)
|
||||
ConfigKeyRelayFRPSWebUIEnabled = "relay_frps_web_ui_enabled" // 是否启用 FRPS 内置 Web 界面
|
||||
ConfigKeyRelayFRPSWebUIPort = "relay_frps_web_ui_port" // FRPS 内置 Web 界面端口
|
||||
ConfigKeyRelayFRPSWebUIEnabled = "relay_frps_web_ui_enabled" // 是否启用 FRPS 内置 Web 界面
|
||||
ConfigKeyRelayFRPSWebUIPort = "relay_frps_web_ui_port" // FRPS 内置 Web 界面端口
|
||||
|
||||
// OpenFlare 业务配置(从 of_options 迁移)
|
||||
ConfigKeyAgentDiscoveryToken = "agent_discovery_token" //nolint:gosec // false positive: config key name. Agent 发现令牌
|
||||
ConfigKeyAgentHeartbeatInterval = "agent_heartbeat_interval" // Agent 心跳间隔(毫秒)
|
||||
ConfigKeyAgentWebsocketUpgradeEnabled = "agent_websocket_upgrade_enabled" // Agent WebSocket 升级开关
|
||||
ConfigKeyNodeOfflineThreshold = "node_offline_threshold" // 节点离线阈值(毫秒)
|
||||
ConfigKeyAgentUpdateRepo = "agent_update_repo" // Agent 更新仓库
|
||||
ConfigKeyGeoIPProvider = "geoip_provider" // GeoIP 服务商
|
||||
ConfigKeyDatabaseAutoCleanupEnabled = "database_auto_cleanup_enabled" // 数据库自动清理开关
|
||||
ConfigKeyDatabaseAutoCleanupRetentionDays = "database_auto_cleanup_retention_days" // 数据库保留天数
|
||||
|
||||
// UptimeKuma 集成配置
|
||||
ConfigKeyUptimeKumaEnabled = "uptime_kuma_enabled" // UptimeKuma 集成开关
|
||||
ConfigKeyUptimeKumaURL = "uptime_kuma_url" // UptimeKuma URL
|
||||
ConfigKeyUptimeKumaUsername = "uptime_kuma_username" // UptimeKuma 用户名
|
||||
ConfigKeyUptimeKumaPassword = "uptime_kuma_password" //nolint:gosec // false positive: config key name. UptimeKuma 密码
|
||||
ConfigKeyUptimeKumaMonitorScope = "uptime_kuma_monitor_scope" // UptimeKuma 监控范围
|
||||
ConfigKeyUptimeKumaSelectedSites = "uptime_kuma_selected_sites" // UptimeKuma 选定站点
|
||||
ConfigKeyUptimeKumaSyncInterval = "uptime_kuma_sync_interval" // UptimeKuma 同步间隔(分钟)
|
||||
ConfigKeyUptimeKumaInterval = "uptime_kuma_interval" // UptimeKuma 监控间隔(秒)
|
||||
ConfigKeyUptimeKumaRetry = "uptime_kuma_retry" // UptimeKuma 重试次数
|
||||
ConfigKeyUptimeKumaRetryInterval = "uptime_kuma_retry_interval" // UptimeKuma 重试间隔(秒)
|
||||
ConfigKeyUptimeKumaTimeout = "uptime_kuma_timeout" // UptimeKuma 超时(秒)
|
||||
|
||||
// OpenResty 配置
|
||||
ConfigKeyOpenRestyDefaultServerReturnStatus = "openresty_default_server_return_status" // 默认服务器返回状态码
|
||||
ConfigKeyOpenRestyWorkerProcesses = "openresty_worker_processes" // Worker 进程数
|
||||
ConfigKeyOpenRestyWorkerConnections = "openresty_worker_connections" // Worker 连接数
|
||||
ConfigKeyOpenRestyWorkerRlimitNofile = "openresty_worker_rlimit_nofile" // Worker 文件描述符限制
|
||||
ConfigKeyOpenRestyEventsUse = "openresty_events_use" // 事件模型
|
||||
ConfigKeyOpenRestyEventsMultiAcceptEnabled = "openresty_events_multi_accept_enabled" // 多路接受开关
|
||||
ConfigKeyOpenRestyKeepaliveTimeout = "openresty_keepalive_timeout" // Keepalive 超时(秒)
|
||||
ConfigKeyOpenRestyKeepaliveRequests = "openresty_keepalive_requests" // Keepalive 请求数
|
||||
ConfigKeyOpenRestyClientHeaderTimeout = "openresty_client_header_timeout" // 客户端头超时(秒)
|
||||
ConfigKeyOpenRestyClientBodyTimeout = "openresty_client_body_timeout" // 客户端体超时(秒)
|
||||
ConfigKeyOpenRestyClientMaxBodySize = "openresty_client_max_body_size" // 客户端最大体大小
|
||||
ConfigKeyOpenRestyLargeClientHeaderBuffers = "openresty_large_client_header_buffers" // 大客户端头缓冲区
|
||||
ConfigKeyOpenRestySendTimeout = "openresty_send_timeout" // 发送超时(秒)
|
||||
ConfigKeyOpenRestyResolvers = "openresty_resolvers" // DNS 解析器
|
||||
ConfigKeyOpenRestyProxyConnectTimeout = "openresty_proxy_connect_timeout" // 代理连接超时(秒)
|
||||
ConfigKeyOpenRestyProxySendTimeout = "openresty_proxy_send_timeout" // 代理发送超时(秒)
|
||||
ConfigKeyOpenRestyProxyReadTimeout = "openresty_proxy_read_timeout" // 代理读取超时(秒)
|
||||
ConfigKeyOpenRestyWebsocketEnabled = "openresty_websocket_enabled" // WebSocket 支持开关
|
||||
ConfigKeyOpenRestyHTTP3Enabled = "openresty_http3_enabled" // HTTP/3 支持开关
|
||||
ConfigKeyOpenRestyProxyRequestBufferingEnabled = "openresty_proxy_request_buffering_enabled" // 代理请求缓冲开关
|
||||
ConfigKeyOpenRestyProxyBufferingEnabled = "openresty_proxy_buffering_enabled" // 代理响应缓冲开关
|
||||
ConfigKeyOpenRestyProxyBuffers = "openresty_proxy_buffers" // 代理缓冲区
|
||||
ConfigKeyOpenRestyProxyBufferSize = "openresty_proxy_buffer_size" // 代理缓冲区大小
|
||||
ConfigKeyOpenRestyProxyBusyBuffersSize = "openresty_proxy_busy_buffers_size" // 代理繁忙缓冲区大小
|
||||
ConfigKeyOpenRestyGzipEnabled = "openresty_gzip_enabled" // Gzip 压缩开关
|
||||
ConfigKeyOpenRestyGzipMinLength = "openresty_gzip_min_length" // Gzip 最小长度
|
||||
ConfigKeyOpenRestyGzipCompLevel = "openresty_gzip_comp_level" // Gzip 压缩级别
|
||||
ConfigKeyOpenRestyCacheEnabled = "openresty_cache_enabled" // 缓存开关
|
||||
ConfigKeyOpenRestyCachePath = "openresty_cache_path" // 缓存路径
|
||||
ConfigKeyOpenRestyCacheLevels = "openresty_cache_levels" // 缓存层级
|
||||
ConfigKeyOpenRestyCacheInactive = "openresty_cache_inactive" // 缓存不活跃时间
|
||||
ConfigKeyOpenRestyCacheMaxSize = "openresty_cache_max_size" // 缓存最大大小
|
||||
ConfigKeyOpenRestyCacheKeyTemplate = "openresty_cache_key_template" // 缓存键模板
|
||||
ConfigKeyOpenRestyCacheLockEnabled = "openresty_cache_lock_enabled" // 缓存锁开关
|
||||
ConfigKeyOpenRestyCacheLockTimeout = "openresty_cache_lock_timeout" // 缓存锁超时
|
||||
ConfigKeyOpenRestyCacheUseStale = "openresty_cache_use_stale" // 缓存失效策略
|
||||
ConfigKeyOpenRestyMainConfigTemplate = "openresty_main_config_template" // 主配置模板
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
Reference in New Issue
Block a user