-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
24 lines (19 loc) · 824 Bytes
/
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
package main
import (
"flag"
"fmt"
"log"
"github.com/PacktPublishing/Cloud-Native-programming-with-Golang/chapter02/myevents/src/eventsservice/rest"
"github.com/PacktPublishing/Cloud-Native-programming-with-Golang/chapter02/myevents/src/lib/configuration"
"github.com/PacktPublishing/Cloud-Native-programming-with-Golang/chapter02/myevents/src/lib/persistence/dblayer"
)
func main() {
confPath := flag.String("conf", `.\configuration\config.json`, "flag to set the path to the configuration json file")
flag.Parse()
//extract configuration
config, _ := configuration.ExtractConfiguration(*confPath)
fmt.Println("Connecting to database")
dbhandler, _ := dblayer.NewPersistenceLayer(config.Databasetype, config.DBConnection)
//RESTful API start
log.Fatal(rest.ServeAPI(config.RestfulEndpoint, dbhandler))
}