Open with or without TLS depending on which environment we are on.

This commit is contained in:
Marco 2022-12-18 15:56:06 +01:00
parent 2803b41186
commit bfc9d247be
1 changed files with 11 additions and 9 deletions

20
main.go
View File

@ -18,19 +18,21 @@ func main() {
log.Println(err)
}
log.Println(hostname)
http.HandleFunc("/", server.SocketHandler)
log.Println("Cert file: ", cert_file)
log.Println("Key file: ", key_file)
err = http.ListenAndServeTLS(":8080", cert_file, key_file, nil)
if err != nil {
log.Println(err)
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("We ended")
log.Println("Fin")
}
func HandleFuncWrapper(a func()) {