From 310fc14261af65fcc2a69fa416400a414eba6374 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?EMRE=20=C3=87EL=C4=B0K?= Date: Thu, 16 Jun 2022 17:21:08 +0300 Subject: [PATCH] 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. --- server/dashboard.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server/dashboard.go b/server/dashboard.go index 8ae1ea86..4e5cabfc 100644 --- a/server/dashboard.go +++ b/server/dashboard.go @@ -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 }