-
Notifications
You must be signed in to change notification settings - Fork 19
/
model_config.go
72 lines (63 loc) · 1.64 KB
/
model_config.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
60
61
62
63
64
65
66
67
68
69
70
71
72
// Copyright 2020 The Moov Authors
// Use of this source code is governed by an Apache License
// license that can be found in the LICENSE file.
package database
import (
"encoding/json"
"time"
"github.com/moov-io/base/mask"
)
type DatabaseConfig struct {
MySQL *MySQLConfig
Spanner *SpannerConfig
DatabaseName string
}
type SpannerConfig struct {
Project string
Instance string
}
type MySQLConfig struct {
Address string
User string
Password string
Connections ConnectionsConfig
UseTLS bool
TLSCAFile string
VerifyCAFile bool
TLSClientCerts []TLSClientCertConfig
// InsecureSkipVerify is a dangerous option which should be used with extreme caution.
// This setting disables multiple security checks performed with TLS connections.
InsecureSkipVerify bool
}
type TLSClientCertConfig struct {
CertFilePath string
KeyFilePath string
}
func (m *MySQLConfig) MarshalJSON() ([]byte, error) {
type Aux struct {
Address string
User string
Password string
Connections ConnectionsConfig
UseTLS bool
TLSCAFile string
InsecureSkipVerify bool
VerifyCAFile bool
}
return json.Marshal(Aux{
Address: m.Address,
User: m.User,
Password: mask.Password(m.Password),
Connections: m.Connections,
UseTLS: m.UseTLS,
TLSCAFile: m.TLSCAFile,
InsecureSkipVerify: m.InsecureSkipVerify,
VerifyCAFile: m.VerifyCAFile,
})
}
type ConnectionsConfig struct {
MaxOpen int
MaxIdle int
MaxLifetime time.Duration
MaxIdleTime time.Duration
}