Test hostname() function.

This commit is contained in:
Marco 2022-12-18 15:43:27 +01:00
parent a727108c82
commit 2803b41186

13
main.go
View File

@ -4,6 +4,7 @@ import (
"log" "log"
"mchess_server/server" "mchess_server/server"
"net/http" "net/http"
"os"
) )
var cert_path = "/etc/letsencrypt/live/chess.sw-gross.de/" var cert_path = "/etc/letsencrypt/live/chess.sw-gross.de/"
@ -12,9 +13,19 @@ var key_file = cert_path + "privkey.pem"
func main() { func main() {
hostname, err := os.Hostname()
if err != nil {
log.Println(err)
}
log.Println(hostname)
http.HandleFunc("/", server.SocketHandler) http.HandleFunc("/", server.SocketHandler)
err := http.ListenAndServeTLS("wogehtspam.:8080", cert_file, key_file, nil) log.Println("Cert file: ", cert_file)
log.Println("Key file: ", key_file)
err = http.ListenAndServeTLS(":8080", cert_file, key_file, nil)
if err != nil { if err != nil {
log.Println(err) log.Println(err)
} }