package main import ( "log" "mchess_server/server" "net/http" "os" ) var cert_path = "/etc/letsencrypt/live/chess.sw-gross.de/" var cert_file = cert_path + "fullchain.pem" var key_file = cert_path + "privkey.pem" func main() { hostname, err := os.Hostname() if err != nil { log.Println(err) } http.HandleFunc("/", server.SocketHandler) if hostname == "mbook" { // My test environment err = http.ListenAndServe(":8080", nil) if err != nil { log.Println(err) } } else { err = http.ListenAndServeTLS(":8080", cert_file, key_file, nil) if err != nil { log.Println(err) } } log.Println("Fin") } func HandleFuncWrapper(a func()) { a() }