Merge pull request #536 from github/go-mysql-ignore-pass
go-mysql library to avoid printing password in cleartext
This commit is contained in:
commit
ce4e42da32
@ -39,7 +39,7 @@ func NewGoMySQLReader(migrationContext *base.MigrationContext) (binlogReader *Go
|
||||
|
||||
serverId := uint32(migrationContext.ReplicaServerId)
|
||||
|
||||
binlogSyncerConfig := &replication.BinlogSyncerConfig{
|
||||
binlogSyncerConfig := replication.BinlogSyncerConfig{
|
||||
ServerID: serverId,
|
||||
Flavor: "mysql",
|
||||
Host: binlogReader.connectionConfig.Key.Hostname,
|
||||
|
2
vendor/github.com/siddontang/go-mysql/README.md
generated
vendored
2
vendor/github.com/siddontang/go-mysql/README.md
generated
vendored
@ -25,7 +25,7 @@ cfg := replication.BinlogSyncerConfig {
|
||||
User: "root",
|
||||
Password: "",
|
||||
}
|
||||
syncer := replication.NewBinlogSyncer(&cfg)
|
||||
syncer := replication.NewBinlogSyncer(cfg)
|
||||
|
||||
// Start sync with sepcified binlog file and position
|
||||
streamer, _ := syncer.StartSync(mysql.Position{binlogFile, binlogPos})
|
||||
|
2
vendor/github.com/siddontang/go-mysql/canal/canal.go
generated
vendored
2
vendor/github.com/siddontang/go-mysql/canal/canal.go
generated
vendored
@ -265,7 +265,7 @@ func (c *Canal) prepareSyncer() error {
|
||||
Password: c.cfg.Password,
|
||||
}
|
||||
|
||||
c.syncer = replication.NewBinlogSyncer(&cfg)
|
||||
c.syncer = replication.NewBinlogSyncer(cfg)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
2
vendor/github.com/siddontang/go-mysql/cmd/go-mysqlbinlog/main.go
generated
vendored
2
vendor/github.com/siddontang/go-mysql/cmd/go-mysqlbinlog/main.go
generated
vendored
@ -45,7 +45,7 @@ func main() {
|
||||
SemiSyncEnabled: *semiSync,
|
||||
}
|
||||
|
||||
b := replication.NewBinlogSyncer(&cfg)
|
||||
b := replication.NewBinlogSyncer(cfg)
|
||||
|
||||
pos := mysql.Position{*file, uint32(*pos)}
|
||||
if len(*backupPath) > 0 {
|
||||
|
9
vendor/github.com/siddontang/go-mysql/replication/binlogsyncer.go
generated
vendored
9
vendor/github.com/siddontang/go-mysql/replication/binlogsyncer.go
generated
vendored
@ -54,7 +54,7 @@ type BinlogSyncerConfig struct {
|
||||
type BinlogSyncer struct {
|
||||
m sync.RWMutex
|
||||
|
||||
cfg *BinlogSyncerConfig
|
||||
cfg BinlogSyncerConfig
|
||||
|
||||
c *client.Conn
|
||||
|
||||
@ -71,8 +71,13 @@ type BinlogSyncer struct {
|
||||
}
|
||||
|
||||
// NewBinlogSyncer creates the BinlogSyncer with cfg.
|
||||
func NewBinlogSyncer(cfg *BinlogSyncerConfig) *BinlogSyncer {
|
||||
func NewBinlogSyncer(cfg BinlogSyncerConfig) *BinlogSyncer {
|
||||
|
||||
// Clear the Password to avoid outputing it in log.
|
||||
pass := cfg.Password
|
||||
cfg.Password = ""
|
||||
log.Infof("create BinlogSyncer with config %v", cfg)
|
||||
cfg.Password = pass
|
||||
|
||||
b := new(BinlogSyncer)
|
||||
|
||||
|
2
vendor/github.com/siddontang/go-mysql/replication/replication_test.go
generated
vendored
2
vendor/github.com/siddontang/go-mysql/replication/replication_test.go
generated
vendored
@ -271,7 +271,7 @@ func (t *testSyncerSuite) setupTest(c *C, flavor string) {
|
||||
Password: "",
|
||||
}
|
||||
|
||||
t.b = NewBinlogSyncer(&cfg)
|
||||
t.b = NewBinlogSyncer(cfg)
|
||||
}
|
||||
|
||||
func (t *testSyncerSuite) testPositionSync(c *C) {
|
||||
|
Loading…
Reference in New Issue
Block a user