Initial Stuff

This commit is contained in:
Caleb Gardner
2021-09-18 02:30:32 -05:00
parent e34ef54b0a
commit 9318ccef18
5 changed files with 209 additions and 2 deletions
+26
View File
@@ -0,0 +1,26 @@
package main
import (
"flag"
"log"
"net/http"
)
func webserver() {
flag.Parse()
path := flag.Arg(0)
keyPath := flag.Arg(0)
if path == "" {
log.Println("No argument given for website file path. website signing off...")
quitChan <- "web arg"
return
} else if keyPath == "" {
log.Println("No argument given for key files. website signing off...")
quitChan <- "web arg"
return
}
http.Handle("/", http.FileServer(http.Dir(path)))
err := http.ListenAndServeTLS(":443", keyPath+"/cert.pem", keyPath+"/key.pem", nil)
log.Println("Error while serving website:", err)
quitChan <- "web err"
}