Don't obliterate custom SSL locations if defined

closes pterodactyl/panel#2121
This commit is contained in:
Dane Everitt 2020-06-29 20:56:13 -07:00
parent d284c4aec9
commit d6a3d9adb1
No known key found for this signature in database
GPG Key ID: EEA66103B3D71F53

View File

@ -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.
@ -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