Browse Source

Merge 84be92d0b7 into 18146ee53b

pull/547/merge
zen_dev 3 months ago
committed by GitHub
parent
commit
37b80ce326
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 1
      client/dtmcli/dtmimp/types.go
  2. 6
      client/dtmcli/dtmimp/utils.go
  3. 1
      conf.sample.yml
  4. 2
      dtmsvr/config/config.go

1
client/dtmcli/dtmimp/types.go

@ -23,4 +23,5 @@ type DBConf struct {
Password string `yaml:"Password"` Password string `yaml:"Password"`
Db string `yaml:"Db"` Db string `yaml:"Db"`
Schema string `yaml:"Schema"` Schema string `yaml:"Schema"`
SSLMode string `yaml:"SSLMode"`
} }

6
client/dtmcli/dtmimp/utils.go

@ -227,9 +227,9 @@ func GetDsn(conf DBConf) string {
driver := conf.Driver driver := conf.Driver
dsn := map[string]string{ dsn := map[string]string{
"mysql": fmt.Sprintf("%s:%s@tcp(%s:%d)/%s?charset=utf8mb4&parseTime=true&loc=Local&interpolateParams=true", "mysql": fmt.Sprintf("%s:%s@tcp(%s:%d)/%s?charset=utf8mb4&parseTime=true&loc=Local&interpolateParams=true",
conf.User, conf.Password, host, conf.Port, conf.Db), conf.User, conf.Password, host, conf.Port, conf.Db), //sslmode=disable
"postgres": fmt.Sprintf("host=%s user=%s password=%s dbname='%s' search_path=%s port=%d sslmode=disable", "postgres": fmt.Sprintf("host=%s user=%s password=%s dbname='%s' search_path=%s port=%d sslmode=%s",
host, conf.User, conf.Password, conf.Db, conf.Schema, conf.Port), host, conf.User, conf.Password, conf.Db, conf.Schema, conf.Port, conf.SSLMode),
// sqlserver://sa:mypass@localhost:1234?database=master&connection+timeout=30 // sqlserver://sa:mypass@localhost:1234?database=master&connection+timeout=30
"sqlserver": getSQLServerConnectionString(&conf, &host), "sqlserver": getSQLServerConnectionString(&conf, &host),
}[driver] }[driver]

1
conf.sample.yml

@ -28,6 +28,7 @@
# Port: '5432' # Port: '5432'
# Db: 'postgres' # Db: 'postgres'
# Schema: 'public' # default value is 'public' # Schema: 'public' # default value is 'public'
# SSLMode: 'disable' # default value is 'disable'
### following config is for only Driver postgres/mysql ### following config is for only Driver postgres/mysql
# MaxOpenConns: 500 # MaxOpenConns: 500

2
dtmsvr/config/config.go

@ -64,6 +64,7 @@ type Store struct {
DataExpire int64 `yaml:"DataExpire" default:"604800"` // Trans data will expire in 7 days. only for redis/boltdb. DataExpire int64 `yaml:"DataExpire" default:"604800"` // Trans data will expire in 7 days. only for redis/boltdb.
FinishedDataExpire int64 `yaml:"FinishedDataExpire" default:"86400"` // finished Trans data will expire in 1 days. only for redis. FinishedDataExpire int64 `yaml:"FinishedDataExpire" default:"86400"` // finished Trans data will expire in 1 days. only for redis.
RedisPrefix string `yaml:"RedisPrefix" default:"{a}"` // Redis storage prefix. store data to only one slot in cluster RedisPrefix string `yaml:"RedisPrefix" default:"{a}"` // Redis storage prefix. store data to only one slot in cluster
SSLMode string `yaml:"SSLMode" default:"disable"`
} }
// IsDB checks config driver is mysql or postgres // IsDB checks config driver is mysql or postgres
@ -81,6 +82,7 @@ func (s *Store) GetDBConf() dtmcli.DBConf {
Password: s.Password, Password: s.Password,
Db: s.Db, Db: s.Db,
Schema: s.Schema, Schema: s.Schema,
SSLMode: s.SSLMode,
} }
} }

Loading…
Cancel
Save