-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
65 lines (56 loc) · 1.19 KB
/
main.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
package main
import (
"ctr-ship/points"
"ctr-ship/pool"
u "ctr-ship/utils"
"log"
"net/http"
)
func main() {
log.Println("🄲 🄾 🄽 🅃 🄰 🄸 🄽 🄴 🅁 🅂 🄷 🄸 🄿")
defer func() {
if r := recover(); r != nil {
log.Panic("main panic: ", r)
}
}()
u.SignalHandler()
var worker pool.Worker = pool.NewWorkerPool(
"./assets/manifests",
"./assets/nodes",
)
points.Web(worker)
points.States(worker)
points.Connection(worker)
points.CargoDeployer(worker)
points.Deployment(worker)
points.Nodes(worker)
points.AllowRequest(worker)
points.Logs(worker)
log.Println("handlers is setup")
// https
go func() {
log.Printf("up https://localhost:8443")
tslConfig, err := u.CertSelf()
if err != nil {
log.Fatalln("fatal generate self cert:", err)
return
}
s := &http.Server{
Addr: ":8443",
Handler: nil,
TLSConfig: tslConfig,
}
err = s.ListenAndServeTLS("", "")
if err != nil {
log.Fatalln("fatal listen serve, addr:", ":8443", err)
return
}
}()
// http
log.Printf("up http://localhost:8080")
err := http.ListenAndServe(":8080", nil)
if err != nil {
log.Fatalln("fatal listen serve, addr:", ":8080", err)
return
}
}