39 lines
628 B
Go
39 lines
628 B
Go
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)
|
|
}
|
|
|
|
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)
|
|
}
|
|
|
|
log.Println("We ended")
|
|
}
|
|
|
|
func HandleFuncWrapper(a func()) {
|
|
a()
|
|
}
|