-
-
Notifications
You must be signed in to change notification settings - Fork 20
/
server_out.go
74 lines (57 loc) · 1.39 KB
/
server_out.go
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// File generated by Gopher Sauce
// DO NOT EDIT!!
package main
import (
"encoding/gob"
"fmt"
"log"
"net/http"
"os"
"os/signal"
assetfs "github.com/elazarl/go-bindata-assetfs"
"github.com/gorilla/sessions"
"github.com/thestrukture/IDE/api/assets"
"github.com/thestrukture/IDE/api/handlers"
sessionStore "github.com/thestrukture/IDE/api/sessions"
"github.com/thestrukture/IDE/types"
)
func init() {
gob.Register(&types.SoftUser{})
}
func main() {
fmt.Fprintf(os.Stdout, "%v\n", os.Getpid())
LaunchServer()
sessionStore.Store.Options = &sessions.Options{
Path: "/",
MaxAge: 86400 * 7,
HttpOnly: true,
Secure: true,
Domain: "",
}
port := ":8884"
if envport := os.ExpandEnv("$PORT"); envport != "" {
port = fmt.Sprintf(":%s", envport)
}
log.Printf("Listenning on Port %v\n", port)
//+++extendgxmlmain+++
stop := make(chan os.Signal, 1)
signal.Notify(stop, os.Interrupt)
http.Handle("/dist/", http.FileServer(&assetfs.AssetFS{Asset: assets.Asset, AssetDir: assets.AssetDir, Prefix: "web"}))
http.HandleFunc("/", handlers.MakeHandler(handlers.Handler))
h := &http.Server{Addr: port}
go func() {
<-stop
log.Println("\nShutting down the server...")
err := h.Close()
if err != nil {
panic(err)
}
Shutdown()
log.Println("Server gracefully stopped")
}()
errgos := h.ListenAndServe()
if errgos != nil {
log.Fatal(errgos)
}
}
//+++extendgxmlroot+++