config

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2026 License: MIT Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	GlobalApiRateLimitNum            = env.Int("GLOBAL_API_RATE_LIMIT", 480)
	GlobalApiRateLimitDuration int64 = 3 * 60

	GlobalWebRateLimitNum            = env.Int("GLOBAL_WEB_RATE_LIMIT", 240)
	GlobalWebRateLimitDuration int64 = 3 * 60

	UploadRateLimitNum            = 10
	UploadRateLimitDuration int64 = 60

	DownloadRateLimitNum            = 10
	DownloadRateLimitDuration int64 = 60

	CriticalRateLimitNum            = 20
	CriticalRateLimitDuration int64 = 20 * 60
)

All duration's unit is seconds Shouldn't larger then RateLimitKeyExpirationDuration

View Source
var AffinityExpireSeconds = env.Int("AFFINITY_EXPIRE_SECONDS", 300)
View Source
var ApproximateTokenEnabled = false
View Source
var AutomaticDisableChannelEnabled = false
View Source
var AutomaticEnableChannelEnabled = false
View Source
var BatchUpdateEnabled = false
View Source
var BatchUpdateInterval = env.Int("BATCH_UPDATE_INTERVAL", 5)
View Source
var ChannelCooldownErrorThreshold = env.Int("CHANNEL_COOLDOWN_ERROR_THRESHOLD", 3)

ChannelCooldownErrorThreshold 累计错误权重达到该阈值才进入冷却;权重 1 的错误需累计该次数

View Source
var ChannelCooldownErrorWindowSeconds = env.Int("CHANNEL_COOLDOWN_ERROR_WINDOW_SECONDS", 120)

ChannelCooldownErrorWindowSeconds 累计窗口,超过该时长未失败则计数清零

View Source
var ChannelCooldownSeconds = env.Int("CHANNEL_COOLDOWN_SECONDS", 600)
View Source
var ChannelDisableThreshold = 5.0
View Source
var DebugEnabled = strings.ToLower(os.Getenv("DEBUG")) == "true"
View Source
var DebugSQLEnabled = strings.ToLower(os.Getenv("DEBUG_SQL")) == "true"
View Source
var EnableMetric = env.Bool("ENABLE_METRIC", false)
View Source
var EnforceIncludeUsage = env.Bool("ENFORCE_INCLUDE_USAGE", false)
View Source
var Footer = ""
View Source
var GeminiSafetySetting = env.String("GEMINI_SAFETY_SETTING", "BLOCK_NONE")
View Source
var GeminiVersion = env.String("GEMINI_VERSION", "v1")
View Source
var InitialRootAccessToken = os.Getenv("INITIAL_ROOT_ACCESS_TOKEN")
View Source
var InitialRootToken = os.Getenv("INITIAL_ROOT_TOKEN")
View Source
var ItemsPerPage = 10
View Source
var JWTExpiresIn = env.Int("JWT_EXPIRES_IN", 604800) // 默认 7 天
View Source
var JWTSecret = "myapi-jwt-secret"
View Source
var LogConsumeEnabled = true
View Source
View Source
var MaxLoggedBodySize = env.Int("MAX_LOGGED_BODY_SIZE", 2*1024*1024) // 默认 2MB

MaxLoggedBodySize 是消费日志中记录请求体的最大字节数,超过则只记录 "[body too large: N bytes]"

View Source
var MaxRecentItems = 100
View Source
var MemoryCacheEnabled = strings.ToLower(os.Getenv("MEMORY_CACHE_ENABLED")) == "true"
View Source
var MetricFailChanSize = env.Int("METRIC_FAIL_CHAN_SIZE", 128)
View Source
var MetricQueueSize = env.Int("METRIC_QUEUE_SIZE", 10)
View Source
var MetricSuccessChanSize = env.Int("METRIC_SUCCESS_CHAN_SIZE", 1024)
View Source
var MetricSuccessRateThreshold = env.Float64("METRIC_SUCCESS_RATE_THRESHOLD", 0.8)
View Source
var OnlyOneLogFile = env.Bool("ONLY_ONE_LOG_FILE", false)
View Source
var OptionMap map[string]string
View Source
var OptionMapRWMutex sync.RWMutex
View Source
var PasswordLoginEnabled = true
View Source
var RateLimitKeyExpirationDuration = 20 * time.Minute
View Source
var RelayProxy = env.String("RELAY_PROXY", "")
View Source
var RelayTimeout = env.Int("RELAY_TIMEOUT", 0) // unit is second
View Source
var RequestInterval = time.Duration(requestInterval) * time.Second
View Source
var RetryTimes = 0
View Source
var RootUserEmail = ""
View Source
var ServerAddress = "http://localhost:3000"
View Source
var SessionSecret = uuid.New().String()
View Source
var SyncFrequency = env.Int("SYNC_FREQUENCY", 10*60) // unit is second
View Source
var SystemName string
View Source
var TestPrompt = env.String("TEST_PROMPT", "Output only your specific model name with no additional text.")
View Source
var TrustedProxies = env.String("TRUSTED_PROXIES", "")

TrustedProxies 逗号分隔的受信任代理 IP/CIDR;为空表示不信任任何代理,ClientIP 取直连地址

View Source
var TurnstileCheckEnabled = false
View Source
var TurnstileSecretKey = ""
View Source
var TurnstileSiteKey = ""
View Source
var UserContentRequestProxy = env.String("USER_CONTENT_REQUEST_PROXY", "")
View Source
var UserContentRequestTimeout = env.Int("USER_CONTENT_REQUEST_TIMEOUT", 30)

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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