From 588da4645b7e94c8e15468e42415994961975abd Mon Sep 17 00:00:00 2001
From: "Kelvin Ly (on the cloud)" <kelvin.ly1618+cloud@gmail.com>
Date: Tue, 30 Oct 2018 22:57:50 +0000
Subject: [PATCH] Whoops, disable debug mode. Might as well set up a flag for
 it...

---
 main.go | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/main.go b/main.go
index ba325da..f1cccb4 100644
--- a/main.go
+++ b/main.go
@@ -25,6 +25,8 @@ var (
 		reload — reloading the configuration file`)
 )
 
+const DEBUG = false
+
 const DOMAIN_NAME = "threefortiethofonehamster.com"
 
 const HTML_HEADER = `<!doctype html5>
@@ -120,10 +122,13 @@ func main() {
 		PidFilePerm: 0644,
 		LogFileName: "/tmp/kelvinly-server-log",
 		LogFilePerm: 0640,
-		//WorkDir:     "/home/kelvin/kelvinly-server/",
-		WorkDir: ".",
-		Umask:   027,
+		WorkDir:     "/home/kelvin/kelvinly-server/",
+		Umask:       027,
 	}
+	if DEBUG {
+		cntxt.WorkDir = "."
+	}
+
 	// TODO: figure out the daemonizing stuff
 
 	if len(daemon.ActiveFlags()) > 0 {
@@ -192,11 +197,12 @@ func startServer(srv *http.Server) {
 	srv.Addr = ":8443"
 	srv.Handler = serveMux
 	log.Print("starting server")
-	/*
+	if !DEBUG {
 		log.Fatal(srv.ListenAndServeTLS("/etc/letsencrypt/live/"+DOMAIN_NAME+"/fullchain.pem",
 			"/etc/letsencrypt/live/"+DOMAIN_NAME+"/privkey.pem"))
-	*/
-	log.Fatal(srv.ListenAndServe())
+	} else {
+		log.Fatal(srv.ListenAndServe())
+	}
 	close(serverShutdown)
 }