Files
gotea/modules/setting/websocket.go
T
lotherk 1b490485ff refactor: import Gotea from Gitea v28.4.0
Rename the main module to gotea.dev and the binary to gotea, and update the application name and English locale. Keep the external gitea.dev/sdk and gitea.dev/actionslib module imports unchanged.

Assisted-by: OpenCode:DeepSeek-V4.1-Flash
2026-11-22 12:13:09 +00:00

35 lines
978 B
Go

// Copyright 2026 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package setting
import "gotea.dev/modules/log"
const (
PubsubTypeMemory = "memory"
PubsubTypeRedis = "redis"
)
// Websocket holds the settings for the websocket event delivery. The pubsub
// backend is scoped to websocket messages only, it is not a general-purpose
// pubsub service.
type WebsocketConfig struct {
PubsubType string
PubsubConnStr string
}
var Websocket = WebsocketConfig{
PubsubType: PubsubTypeMemory,
}
func loadWebsocketFrom(rootCfg ConfigProvider) {
sec := rootCfg.Section("websocket")
Websocket.PubsubType = sec.Key("PUBSUB_TYPE").In(PubsubTypeMemory, []string{PubsubTypeMemory, PubsubTypeRedis})
if Websocket.PubsubType == PubsubTypeRedis {
Websocket.PubsubConnStr = sec.Key("PUBSUB_CONN_STR").MustString(Redis.ConnStr)
if Websocket.PubsubConnStr == "" {
log.Fatal("[websocket].PUBSUB_CONN_STR is required when PUBSUB_TYPE = redis")
}
}
}