-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
32 lines (24 loc) · 1018 Bytes
/
main.go
File metadata and controls
32 lines (24 loc) · 1018 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
package main
import (
"net/http"
"log"
"github.com/kfcoding-cloudware-controller/configs"
"github.com/kfcoding-cloudware-controller/apihandler"
"github.com/kfcoding-cloudware-controller/service"
"github.com/kfcoding-cloudware-controller/etcd"
"path"
)
func main() {
configs.InitEnv()
etcdClient := etcd.GetMyEtcdClient()
keeperService := service.GetKeeperEtcdService(etcdClient)
routingService := service.GetRoutingTraefikService(etcdClient)
cloudwareService := service.GetCloudwareK8sService(keeperService, routingService)
watcher := service.GetEtcdWatcher(etcdClient)
go watcher.Watcher(path.Join(configs.KeeperPrefix, configs.Version), cloudwareService)
http.Handle("/keep/", apihandler.CreateKeeperController(keeperService))
http.Handle("/routing/", apihandler.CreateRoutingController(routingService))
http.Handle("/cloudware/", apihandler.CreateCloudwareController(cloudwareService))
log.Println("Start cloudware server v1")
log.Fatal(http.ListenAndServe(configs.ServerAddress, nil))
}