-
Notifications
You must be signed in to change notification settings - Fork 26
/
tang.go
38 lines (32 loc) · 693 Bytes
/
tang.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
package config
import (
"github.com/content-services/tang/pkg/tangy"
"github.com/rs/zerolog/log"
)
var Tang *tangy.Tangy
func ConfigureTang() error {
if Get().Clients.Pulp.Server == "" || !Get().Features.Snapshots.Enabled {
return nil
}
pDb := Get().Clients.Pulp.Database
tDb := tangy.Database{
Name: pDb.Name,
Host: pDb.Host,
Port: pDb.Port,
User: pDb.User,
Password: pDb.Password,
CACertPath: pDb.CACertPath,
PoolLimit: pDb.PoolLimit,
}
tLogger := tangy.Logger{
Logger: &log.Logger,
LogLevel: Get().Logging.Level,
Enabled: true,
}
t, err := tangy.New(tDb, tLogger)
if err != nil {
return err
}
Tang = &t
return nil
}