package constant const ( // ConfigPath 配置文件路径 ConfigPath = "configs/config.ini" // DataDir 数据目录 DataDir = "./data" // DefaultDBPath 默认数据库路径 DefaultDBPath = "./data/baihu.db" // WebDistDir 前端构建目录 WebDistDir = "./web/dist" // DefaultRole 默认用户角色 DefaultRole = "user" // AdminRole 管理员角色 AdminRole = "admin" // ScriptsWorkDir 脚本工作目录 ScriptsWorkDir = "./data/scripts" // CookieName Cookie 名称 CookieName = "BHToken" // DefaultTaskTimeout 默认任务超时时间(分钟) DefaultTaskTimeout = 30 // Settings Section 常量 SectionSite = "site" SectionSystem = "system" SectionScheduler = "scheduler" SectionSecurity = "security" SectionNotify = "notify" // Site Settings Key 常量 KeyTitle = "title" KeySubtitle = "subtitle" KeyIcon = "icon" KeyPageSize = "page_size" KeyCookieDays = "cookie_days" KeyOpenapiToken = "openapi_token" // Security Settings Key 常量 KeySecret = "secret" // System Settings Key 常量 KeyInitialized = "initialized" KeyLogRetention = "log_retention" // Scheduler Settings Key 常量 KeyWorkerCount = "worker_count" KeyQueueSize = "queue_size" KeyRateInterval = "rate_interval" // Notify Settings Key 常量 KeyNotifyChannels = "channels" KeyNotifyEvents = "events" KeyNotifyToken = "notify_token" // 事件绑定类型 BindingTypeSystem = "system" BindingTypeTask = "task" // 系统事件类型 EventUserLogin = "user_login" EventBruteForceLogin = "brute_force_login" EventPasswordChanged = "password_changed" // 任务事件类型 EventTaskSuccess = "task_success" EventTaskFailed = "task_failed" EventTaskTimeout = "task_timeout" // 其他事件类型 EventSystemNotice = "system_notice" EventNotifySent = "notify_sent" // WebSocket 消息类型 WSTypeHeartbeat = "heartbeat" WSTypeHeartbeatAck = "heartbeat_ack" WSTypeTasks = "tasks" WSTypeTaskResult = "task_result" WSTypeTaskLog = "task_log" WSTypeExecute = "execute" WSTypeUpdate = "update" WSTypeDisconnect = "disconnect" WSTypeConnected = "connected" WSTypeDisabled = "disabled" WSTypeEnabled = "enabled" WSTypeFetchTasks = "fetch_tasks" WSTypeTaskHeartbeat = "task_heartbeat" WSTypeStop = "stop" // 任务状态 TaskStatusSuccess = "success" TaskStatusFailed = "failed" TaskStatusRunning = "running" TaskStatusPending = "pending" TaskStatusTimeout = "timeout" TaskStatusCancelled = "cancelled" TaskStatusQueued = "queued" // 任务类型 TaskTypeNormal = "task" TaskTypeRepo = "repo" // 触发类型 TriggerTypeCron = "cron" TriggerTypeBaihuStartup = "baihu_startup" // Agent 状态 AgentStatusOnline = "online" AgentStatusOffline = "offline" // AppLog 分类 LogCategoryDefault = "default" LogCategorySystemNotice = "system_notice" LogCategoryPushLog = "push_log" // AppLog 级别 LogLevelInfo = "info" LogLevelWarning = "warning" LogLevelError = "error" // AppLog 状态 LogStatusUnread = "unread" LogStatusRead = "read" LogStatusSuccess = "success" LogStatusFailed = "failed" ) // TablePrefix 表前缀,从配置文件读取 var TablePrefix string // Secret JWT和密码salt密钥,运行中自动从数据库加载 var Secret string // DemoMode 演示模式,从环境变量读取 var DemoMode bool // DefaultIcon 默认站点图标 var DefaultIcon = `` // DefaultSettings 默认系统设置 var DefaultSettings = map[string]map[string]string{ SectionSite: { KeyTitle: "白虎面板", KeySubtitle: "极致轻量、高性能的自动化任务调度平台", KeyIcon: DefaultIcon, KeyPageSize: "10", KeyCookieDays: "7", }, SectionScheduler: { KeyWorkerCount: "4", KeyQueueSize: "100", KeyRateInterval: "200", }, } // DefaultLogRetention 默认日志清理配置 var DefaultLogRetention = `{"system_notice":{"days":30,"max_count":500},"push_log":{"days":15,"max_count":5000}}`