Server Dashboard SSL Support

Added a simple if-else statement that checks TLSOnly mode enabled. If enabled, serves the dashboard in HTTPS mode. Otherwise, serves the dashboard in HTTP mode. 
If TLSCertFile and TLSKeyFile are not used in config but TLSOnly is enabled, the HTTPS dashboard does not loads.

Tested on Debian Linux and Windows Server 2012.
This commit is contained in:
EMRE ÇELİK 2022-06-16 17:21:08 +03:00 committed by GitHub
parent c652b8ef07
commit 310fc14261
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -84,6 +84,10 @@ func (svr *Service) RunDashboardServer(address string) (err error) {
return err
}
go server.Serve(ln)
if svr.cfg.TLSOnly {
go server.ServeTLS(ln, svr.cfg.TLSCertFile, svr.cfg.TLSKeyFile)
} else {
go server.Serve(ln)
}
return
}