Full Mattermost server source with integrated Community Enterprise features. Includes vendor directory for offline/air-gapped builds. Structure: - enterprise-impl/: Enterprise feature implementations - enterprise-community/: Init files that register implementations - enterprise/: Bridge imports (community_imports.go) - vendor/: All dependencies for offline builds Build (online): go build ./cmd/mattermost Build (offline/air-gapped): go build -mod=vendor ./cmd/mattermost 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
54 lines
1.4 KiB
Go
54 lines
1.4 KiB
Go
// Copyright (c) 2024 Mattermost Community Enterprise
|
|
// Registration of Redis cluster implementation
|
|
|
|
package cluster
|
|
|
|
import (
|
|
"os"
|
|
|
|
"github.com/mattermost/mattermost/server/public/model"
|
|
"github.com/mattermost/mattermost/server/public/shared/mlog"
|
|
"github.com/mattermost/mattermost/server/v8/channels/app/platform"
|
|
"github.com/mattermost/mattermost/server/v8/einterfaces"
|
|
|
|
enterprisecluster "github.com/mattermost-community/enterprise/cluster"
|
|
)
|
|
|
|
func init() {
|
|
platform.RegisterClusterInterface(NewRedisClusterInterface)
|
|
}
|
|
|
|
func NewRedisClusterInterface(ps *platform.PlatformService) einterfaces.ClusterInterface {
|
|
// Check if Redis cluster is enabled via environment variables
|
|
redisAddr := os.Getenv("MM_CLUSTER_REDIS_ADDR")
|
|
if redisAddr == "" {
|
|
// Cluster not enabled
|
|
return nil
|
|
}
|
|
|
|
redisPassword := os.Getenv("MM_CLUSTER_REDIS_PASSWORD")
|
|
clusterID := os.Getenv("MM_CLUSTER_ID")
|
|
if clusterID == "" {
|
|
clusterID = "default"
|
|
}
|
|
|
|
cfg := &enterprisecluster.RedisClusterConfig{
|
|
RedisAddr: redisAddr,
|
|
RedisPassword: redisPassword,
|
|
RedisDB: 0,
|
|
ClusterID: clusterID,
|
|
Logger: ps.Log(),
|
|
Version: model.CurrentVersion,
|
|
SchemaVersion: "", // Will be set from DB schema
|
|
ConfigHash: "",
|
|
}
|
|
|
|
cluster, err := enterprisecluster.NewRedisCluster(cfg)
|
|
if err != nil {
|
|
mlog.Error("Failed to initialize Redis cluster", mlog.Err(err))
|
|
return nil
|
|
}
|
|
|
|
return cluster
|
|
}
|