-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
35 lines (29 loc) · 682 Bytes
/
main.go
File metadata and controls
35 lines (29 loc) · 682 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package main
import (
"fmt"
"iliad-connect/handlers"
"log"
"net/http"
"os"
)
func main() {
log.Println(os.Getenv("PORT"))
server := &http.Server{
Addr: fmt.Sprintf(":" + os.Getenv("PORT")),
Handler: handlers.New(),
}
log.Printf("Starting HTTP Server. Listening at %q", server.Addr)
if _, ok := os.LookupEnv("LOCAL_SERVER"); ok {
if err := server.ListenAndServeTLS("localhost.crt", "localhost.key"); err != http.ErrServerClosed {
log.Printf("%v", err)
} else {
log.Println("Server closed!")
}
} else {
if err := server.ListenAndServe(); err != http.ErrServerClosed {
log.Printf("%v", err)
} else {
log.Println("Server closed!")
}
}
}