Allow SSL cert paths to be specified in config (#4910)

This commit is contained in:
Flashy78 2024-06-10 20:11:41 -07:00 committed by GitHub
parent 62bdff351d
commit dcb86d9186
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 14 additions and 2 deletions

View File

@ -232,6 +232,9 @@ const (
SecurityTripwireAccessedFromPublicInternet = "security_tripwire_accessed_from_public_internet"
securityTripwireAccessedFromPublicInternetDefault = ""
sslCertPath = "ssl_cert_path"
sslKeyPath = "ssl_key_path"
// DLNA options
DLNAServerName = "dlna.server_name"
DLNADefaultEnabled = "dlna.default_enabled"
@ -356,8 +359,17 @@ func (i *Config) InitTLS() {
paths.GetStashHomeDirectory(),
}
i.certFile = fsutil.FindInPaths(tlsPaths, "stash.crt")
i.keyFile = fsutil.FindInPaths(tlsPaths, "stash.key")
i.certFile = i.getString(sslCertPath)
if i.certFile == "" {
// Look for default file
i.certFile = fsutil.FindInPaths(tlsPaths, "stash.crt")
}
i.keyFile = i.getString(sslKeyPath)
if i.keyFile == "" {
// Look for default file
i.keyFile = fsutil.FindInPaths(tlsPaths, "stash.key")
}
}
func (i *Config) GetTLSFiles() (certFile, keyFile string) {