configurable socket log count; closes pterodactyl/panel#2659

This commit is contained in:
Dane Everitt 2020-11-06 20:56:21 -08:00
parent af9ed4bff1
commit a74be8f4eb
No known key found for this signature in database
GPG Key ID: EEA66103B3D71F53
2 changed files with 6 additions and 3 deletions

View File

@ -70,6 +70,9 @@ type SystemConfiguration struct {
// when it boots and one is not detected. // when it boots and one is not detected.
EnableLogRotate bool `default:"true" yaml:"enable_log_rotate"` 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"` 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") 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 // 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 // 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. // fall through to UTC to get Wings booted at least.
@ -222,4 +225,4 @@ func (sc *SystemConfiguration) ConfigureTimezone() error {
_, err := time.LoadLocation(sc.Timezone) _, err := time.LoadLocation(sc.Timezone)
return errors.Wrap(err, fmt.Sprintf("the supplied timezone %s is invalid", sc.Timezone)) return errors.Wrap(err, fmt.Sprintf("the supplied timezone %s is invalid", sc.Timezone))
} }

View File

@ -368,7 +368,7 @@ func (h *Handler) HandleInbound(m Message) error {
return nil return nil
} }
logs, err := h.server.Environment.Readlog(100) logs, err := h.server.Environment.Readlog(config.Get().System.WebsocketLogCount)
if err != nil { if err != nil {
return err return err
} }