-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
47 lines (37 loc) · 970 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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package main
import (
/* debug */
"fmt"
"log"
// may have to use this when dockerizing
"github.com/ilyakaznacheev/cleanenv"
/* database */
"time"
// gocql implements a fast and robust Cassandra client for the Go programming language
"github.com/gocql/gocql"
// ----
"github.com/Team-Retrospect/api-server/src/structs"
"github.com/Team-Retrospect/api-server/src/webserver"
)
var cfg structs.Config
// taking the information from the .yml file and putting it into a Struct
func load_cfg() {
cleanenv.ReadConfig("./config.yml", &cfg)
}
func main() {
load_cfg()
// connect to the Cassandra cluster
fmt.Println("Connecting to Cassandra...")
cluster := gocql.NewCluster(cfg.Cluster)
cluster.Consistency = gocql.Quorum
cluster.ProtoVersion = 4
cluster.ConnectTimeout = time.Second * 10
s, err := cluster.CreateSession()
if err != nil {
log.Println(err)
return
}
session := s
defer session.Close()
webserver.DeclareRouter(cfg, session)
}