Skip to content

Commit

Permalink
Don't obliterate custom SSL locations if defined
Browse files Browse the repository at this point in the history
  • Loading branch information
DaneEveritt committed Jun 30, 2020
1 parent d284c4a commit d6a3d9a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions router/router_system.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/pterodactyl/wings/server"
"github.com/pterodactyl/wings/system"
"net/http"
"strings"
)

// Returns information about the system that wings is running on.
Expand Down Expand Up @@ -78,6 +79,16 @@ func postUpdateConfiguration(c *gin.Context) {
return
}

// Keep the SSL certificates the same since the Panel will send through Lets Encrypt
// default locations. However, if we picked a different location manually we don't
// want to override that.
//
// If you pass through manual locations in the API call this logic will be skipped.
if strings.HasPrefix(cfg.Api.Ssl.KeyFile, "/etc/letsencrypt/live/") {
cfg.Api.Ssl.KeyFile = ccopy.Api.Ssl.KeyFile
cfg.Api.Ssl.CertificateFile = ccopy.Api.Ssl.CertificateFile
}

config.Set(&cfg)
if err := config.Get().WriteToDisk(); err != nil {
// If there was an error writing to the disk, revert back to the configuration we had
Expand Down

0 comments on commit d6a3d9a

Please sign in to comment.