Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions client/dtmcli/dtmimp/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ type DBConf struct {
Password string `yaml:"Password"`
Db string `yaml:"Db"`
Schema string `yaml:"Schema"`
SSLMode string `yaml:"SSLMode"`
}
6 changes: 3 additions & 3 deletions client/dtmcli/dtmimp/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,9 @@ func GetDsn(conf DBConf) string {
driver := conf.Driver
dsn := map[string]string{
"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),
"postgres": fmt.Sprintf("host=%s user=%s password=%s dbname='%s' search_path=%s port=%d sslmode=disable",
host, conf.User, conf.Password, conf.Db, conf.Schema, conf.Port),
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=%s",
host, conf.User, conf.Password, conf.Db, conf.Schema, conf.Port, conf.SSLMode),
// sqlserver://sa:mypass@localhost:1234?database=master&connection+timeout=30
"sqlserver": getSQLServerConnectionString(&conf, &host),
}[driver]
Expand Down
1 change: 1 addition & 0 deletions conf.sample.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
# Port: '5432'
# Db: 'postgres'
# Schema: 'public' # default value is 'public'
# SSLMode: 'disable' # default value is 'disable'

### following config is for only Driver postgres/mysql
# MaxOpenConns: 500
Expand Down
2 changes: 2 additions & 0 deletions dtmsvr/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ type Store struct {
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.
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
Expand All @@ -80,6 +81,7 @@ func (s *Store) GetDBConf() dtmcli.DBConf {
Password: s.Password,
Db: s.Db,
Schema: s.Schema,
SSLMode: s.SSLMode,
}
}

Expand Down