From a74be8f4ebb56a3933917153f62718ede55f1067 Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Fri, 6 Nov 2020 20:56:21 -0800 Subject: [PATCH] configurable socket log count; closes pterodactyl/panel#2659 --- config/config_system.go | 7 +++++-- router/websocket/websocket.go | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/config/config_system.go b/config/config_system.go index 3b982c2..8538645 100644 --- a/config/config_system.go +++ b/config/config_system.go @@ -70,6 +70,9 @@ type SystemConfiguration struct { // when it boots and one is not detected. EnableLogRotate bool `default:"true" yaml:"enable_log_rotate"` + // The number of lines to send when a server connects to the websocket. + WebsocketLogCount int `default:"150" yaml:"websocket_log_count"` + Sftp SftpConfiguration `yaml:"sftp"` } @@ -190,7 +193,7 @@ func (sc *SystemConfiguration) ConfigureTimezone() error { return errors.Wrap(err, "failed to open /etc/timezone for automatic server timezone calibration") } - ctx, _ := context.WithTimeout(context.Background(), time.Second * 5) + ctx, _ := context.WithTimeout(context.Background(), time.Second*5) // Okay, file isn't found on this OS, we will try using timedatectl to handle this. If this // command fails, exit, but if it returns a value use that. If no value is returned we will // fall through to UTC to get Wings booted at least. @@ -222,4 +225,4 @@ func (sc *SystemConfiguration) ConfigureTimezone() error { _, err := time.LoadLocation(sc.Timezone) return errors.Wrap(err, fmt.Sprintf("the supplied timezone %s is invalid", sc.Timezone)) -} \ No newline at end of file +} diff --git a/router/websocket/websocket.go b/router/websocket/websocket.go index 9a72aaf..c764be3 100644 --- a/router/websocket/websocket.go +++ b/router/websocket/websocket.go @@ -368,7 +368,7 @@ func (h *Handler) HandleInbound(m Message) error { return nil } - logs, err := h.server.Environment.Readlog(100) + logs, err := h.server.Environment.Readlog(config.Get().System.WebsocketLogCount) if err != nil { return err }