Minor tweaks to diagnostics for cleaner info, changes endpoint; closes pterodactyl/panel#2463

This commit is contained in:
Dane Everitt 2020-10-11 15:23:55 -07:00
parent e29789114c
commit 6c291d9b0e
No known key found for this signature in database
GPG Key ID: EEA66103B3D71F53
2 changed files with 22 additions and 22 deletions

View File

@ -13,6 +13,7 @@ import (
"path" "path"
"strconv" "strconv"
"strings" "strings"
"time"
"github.com/AlecAivazis/survey/v2" "github.com/AlecAivazis/survey/v2"
"github.com/AlecAivazis/survey/v2/terminal" "github.com/AlecAivazis/survey/v2/terminal"
@ -25,8 +26,8 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
const DefaultHastebinUrl = "https://hastebin.com" const DefaultHastebinUrl = "https://ptero.co"
const DefaultLogLines = 50 const DefaultLogLines = 200
var ( var (
diagnosticsArgs struct { diagnosticsArgs struct {
@ -103,22 +104,24 @@ func diagnosticsCmdRun(cmd *cobra.Command, args []string) {
cfg, err := config.ReadConfiguration(config.DefaultLocation) cfg, err := config.ReadConfiguration(config.DefaultLocation)
if cfg != nil { if cfg != nil {
fmt.Fprintln(output, " Panel Location:", redact(cfg.PanelLocation)) fmt.Fprintln(output, " Panel Location:", redact(cfg.PanelLocation))
fmt.Fprintln(output, "Api Host:", redact(cfg.Api.Host)) fmt.Fprintln(output, "")
fmt.Fprintln(output, "Api Port:", cfg.Api.Port) fmt.Fprintln(output, "Internal Webserver:", redact(cfg.Api.Host) + ":", cfg.Api.Port)
fmt.Fprintln(output, "Api Ssl Enabled:", cfg.Api.Ssl.Enabled) fmt.Fprintln(output, " SSL Enabled:", cfg.Api.Ssl.Enabled)
fmt.Fprintln(output, "Api Ssl Certificate:", redact(cfg.Api.Ssl.CertificateFile)) fmt.Fprintln(output, " SSL Certificate:", redact(cfg.Api.Ssl.CertificateFile))
fmt.Fprintln(output, "Api Ssl Key:", redact(cfg.Api.Ssl.KeyFile)) fmt.Fprintln(output, " SSL Key:", redact(cfg.Api.Ssl.KeyFile))
fmt.Fprintln(output, "Sftp Address:", redact(cfg.System.Sftp.Address)) fmt.Fprintln(output, "")
fmt.Fprintln(output, "Sftp Port:", cfg.System.Sftp.Port) fmt.Fprintln(output, " SFTP Server:", redact(cfg.System.Sftp.Address), ":", cfg.System.Sftp.Port)
fmt.Fprintln(output, "Sftp Read Only:", cfg.System.Sftp.ReadOnly) fmt.Fprintln(output, " SFTP Read-Only:", cfg.System.Sftp.ReadOnly)
fmt.Fprintln(output, "Sftp Diskchecking Disabled:", cfg.System.Sftp.DisableDiskChecking) fmt.Fprintln(output, "")
fmt.Fprintln(output, "System Root Directory:", cfg.System.RootDirectory) fmt.Fprintln(output, " Root Directory:", cfg.System.RootDirectory)
fmt.Fprintln(output, "System Logs Directory:", cfg.System.LogDirectory) fmt.Fprintln(output, " Logs Directory:", cfg.System.LogDirectory)
fmt.Fprintln(output, "System Data Directory:", cfg.System.Data) fmt.Fprintln(output, " Data Directory:", cfg.System.Data)
fmt.Fprintln(output, "System Archive Directory:", cfg.System.ArchiveDirectory) fmt.Fprintln(output, " Archive Directory:", cfg.System.ArchiveDirectory)
fmt.Fprintln(output, "System Backup Directory:", cfg.System.BackupDirectory) fmt.Fprintln(output, " Backup Directory:", cfg.System.BackupDirectory)
fmt.Fprintln(output, "System Username:", cfg.System.Username) fmt.Fprintln(output, "")
fmt.Fprintln(output, "Debug Enabled:", cfg.Debug) fmt.Fprintln(output, " Username:", cfg.System.Username)
fmt.Fprintln(output, " Server Time:", time.Now().Format(time.RFC1123Z))
fmt.Fprintln(output, " Debug Mode:", cfg.Debug)
} else { } else {
fmt.Println("Failed to load configuration.", err) fmt.Println("Failed to load configuration.", err)
} }

View File

@ -73,9 +73,6 @@ type Configuration struct {
// Defines the configuration of the internal SFTP server. // Defines the configuration of the internal SFTP server.
type SftpConfiguration struct { type SftpConfiguration struct {
// If set to true disk checking will not be performed. This will prevent the SFTP
// server from checking the total size of a directory when uploading files.
DisableDiskChecking bool `default:"false" yaml:"disable_disk_checking"`
// The bind address of the SFTP server. // The bind address of the SFTP server.
Address string `default:"0.0.0.0" json:"bind_address" yaml:"bind_address"` Address string `default:"0.0.0.0" json:"bind_address" yaml:"bind_address"`
// The bind port of the SFTP server. // The bind port of the SFTP server.