-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
59 lines (49 loc) · 1.8 KB
/
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
48
49
50
51
52
53
54
55
56
57
58
59
package main
import (
"flag"
"github.com/tomekkolo/immudb-play/cmd"
)
var flagQueryOnly bool
var flagAuditTrailJson bool
var flagPgauditTrail bool
var flagFollow bool
func init() {
flag.BoolVar(&flagQueryOnly, "query-only", false, "if True, do not save into immudb")
flag.BoolVar(&flagAuditTrailJson, "audit-trail-json", false, "if True, run AuditTrailJson")
flag.BoolVar(&flagPgauditTrail, "pgaudit", false, "if True, run pgaudit")
flag.BoolVar(&flagFollow, "follow", false, "if True, run pgaudit")
flag.Parse()
}
func main() {
cmd.Execute()
return
// create immudb client
// opts := client.DefaultOptions().WithAddress("localhost").WithPort(3322)
// immuCli := client.NewClient().WithOptions(opts)
// err := immuCli.OpenSession(context.TODO(), []byte(`immudb`), []byte(`immudb`), "defaultdb")
// if err != nil {
// log.Fatal(err)
// }
// defer immuCli.CloseSession(context.TODO())
// log.Printf("flagAuditTrailJson: %t\n", flagAuditTrailJson)
// if flagAuditTrailJson {
// // configure repository
// jsonRepository := immudb.NewJsonKVRepository(client, "trail", []string{"id", "user", "action"})
// auditTrail := audittrail.NewAuditTrailJson(jsonRepository, flagQueryOnly, 10, "user", "user1")
// auditTrail.Run()
// }
// if flagPgauditTrail {
// }
// jsonRepository := immudb.NewJsonKVRepository(immuCli, "pgaudit", []string{"statement_id", "timestamp", "audit_type", "class", "command"})
// fileTail, err := source.NewFileTail("test/pgaudit.log", flagFollow)
// if err != nil {
// log.Panic(err)
// }
// s := service.NewAuditService(fileTail, pgaudit.NewPGAuditLineParser(), jsonRepository)
// s.Run()
//audittrail.AuditTrailSQL(queryOnly)
//audittrail.AuditTrailKV(queryOnly)
//audittrail.AuditTrailKVGjson(queryOnly)
//audittrail.PopulatePSQL()
//audittrail.PGAuditTrail(queryOnly)
}