Skip to content

Commit

Permalink
support uni codes
Browse files Browse the repository at this point in the history
  • Loading branch information
FZambia committed Nov 14, 2024
1 parent df95c5b commit 98fd4d6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
7 changes: 7 additions & 0 deletions internal/app/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ func centrifugeNodeConfig(version string, cfgContainer *config.Container) centri
cfg.ClientConnectIncludeServerTime = appCfg.Client.ConnectIncludeServerTime
cfg.LogLevel = logging.CentrifugeLogLevel(strings.ToLower(appCfg.LogLevel))
cfg.LogHandler = logging.NewCentrifugeLogHandler().Handle
if appCfg.Client.ConnectCodeToUnidirectionalDisconnect.Enabled {
uniCodeTransforms := make(map[uint32]centrifuge.Disconnect)
for _, transform := range appCfg.Client.ConnectCodeToUnidirectionalDisconnect.Transforms {
uniCodeTransforms[transform.Code] = centrifuge.Disconnect{Code: transform.To.Code, Reason: transform.To.Reason}
}
cfg.UnidirectionalCodeToDisconnect = uniCodeTransforms
}
return cfg
}

Expand Down
7 changes: 4 additions & 3 deletions internal/app/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"os/signal"
"path/filepath"
"runtime"
"strings"
"sync"
"syscall"
"time"
Expand Down Expand Up @@ -57,9 +58,9 @@ func Run(cmd *cobra.Command, configFile string) {
if err != nil {
log.Fatal().Msgf("error writing PID: %v", err)
}
if os.Getenv("GOMAXPROCS") == "" {
_, _ = maxprocs.Set()
}
_, _ = maxprocs.Set(maxprocs.Logger(func(s string, i ...interface{}) {
log.Info().Msgf(strings.ToLower(s), i...)
}))

log.Info().
Str("version", build.Version).
Expand Down

0 comments on commit 98fd4d6

Please sign in to comment.