summary refs log tree commit diff stats
path: root/svc/svc.go
diff options
context:
space:
mode:
authorBen Morrison <ben@gbmor.dev>2019-06-11 18:49:16 -0400
committerBen Morrison <ben@gbmor.dev>2019-06-11 18:49:16 -0400
commit45ee3c060433c58a0a89de223655381933e7df11 (patch)
tree7915b74fe7be9bde61ccfd408cc3bbeb170265d8 /svc/svc.go
parent6dad1372a4680f2314a057b831f8cb2ef44dcf1b (diff)
downloadgetwtxt-45ee3c060433c58a0a89de223655381933e7df11.tar.gz
added support for TLS and hostname resolution
Diffstat (limited to 'svc/svc.go')
-rw-r--r--svc/svc.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/svc/svc.go b/svc/svc.go
index e5802d2..1748bf0 100644
--- a/svc/svc.go
+++ b/svc/svc.go
@@ -25,6 +25,9 @@ func Start() {
 	if !confObj.IsProxied {
 		index.Host(confObj.Instance.URL)
 	}
+	TLS := confObj.TLS.Use
+	TLSCert := confObj.TLS.Cert
+	TLSKey := confObj.TLS.Key
 	confObj.Mu.RUnlock()
 
 	setIndexRouting(index)
@@ -34,7 +37,11 @@ func Start() {
 	server := newServer(portnum, index)
 	log.Printf("*** Listening on %v\n", portnum)
 	log.Printf("*** getwtxt %v Startup finished at %v, took %v\n\n", Vers, time.Now().Format(time.RFC3339), time.Since(before))
-	errLog("", server.ListenAndServe())
+	if TLS {
+		errLog("", server.ListenAndServeTLS(TLSCert, TLSKey))
+	} else {
+		errLog("", server.ListenAndServe())
+	}
 
 	closeLog <- true
 	killTickers()