-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathmain.go
39 lines (32 loc) · 779 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
package main
import (
"context"
"flag"
"fmt"
"log"
"os"
"path/filepath"
"github.com/fullstorydev/hauser/client"
"github.com/fullstorydev/hauser/config"
"github.com/fullstorydev/hauser/core"
)
var version = "dev build <no version set>"
func main() {
conffile := flag.String("c", "config.toml", "configuration file")
printVersion := flag.Bool("version", false, "print version")
flag.Parse()
if *printVersion {
fmt.Printf("%s %s\n", filepath.Base(os.Args[0]), version)
os.Exit(0)
}
conf, err := config.Load(*conffile)
if err != nil {
log.Fatal(err)
}
ctx := context.Background()
store := core.MakeStorage(ctx, conf)
database := core.MakeDatabase(ctx, conf)
cl := client.NewClient(conf)
h := core.NewHauser(conf, cl, store, database)
h.Run(ctx)
}