-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
46 lines (39 loc) · 1.04 KB
/
main.go
File metadata and controls
46 lines (39 loc) · 1.04 KB
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
package main
import (
"log"
"github.com/Senior-Design-Kappa/web/auth"
"github.com/Senior-Design-Kappa/web/backend"
"github.com/Senior-Design-Kappa/web/config"
"github.com/Senior-Design-Kappa/web/logic"
"github.com/Senior-Design-Kappa/web/router"
)
func main() {
conf := config.NewDefaultConfig()
conf.UpdateFromEnvironment()
b := makeBackend(conf)
l := makeLogic(conf, b)
a := makeAuth(conf)
s := router.NewServer(conf, l, a)
log.Fatal(s.ListenAndServe())
}
func makeAuth(conf config.Config) auth.Auth {
a, err := auth.NewAuth(conf)
if err != nil {
log.Fatalf("error: auth layer could not be created (%+v)\n", err)
}
return *a
}
func makeBackend(conf config.Config) backend.Backend {
b, err := backend.NewBackend(conf)
if err != nil {
log.Fatalf("error: backend layer could not be created (%+v)\n", err)
}
return b
}
func makeLogic(conf config.Config, backend backend.Backend) logic.Logic {
l, err := logic.NewLogic(conf, backend)
if err != nil {
log.Fatalf("error: logic layer could not be created (%+v)\n", err)
}
return l
}