Skip to content

Commit

Permalink
Merge pull request #22 from aliyun/feature/adjust_sts
Browse files Browse the repository at this point in the history
fix: use sts token for hologres if input
  • Loading branch information
bruceding authored Jul 9, 2024
2 parents 8232fd1 + 282762b commit 5068426
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions api/model_datasource.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ func (d *Datasource) GenerateDSN(datasourceType string) (DSN string) {
if d.TestMode {
if d.Ak.SecurityToken != "" {
DSN = fmt.Sprintf("postgres://paifsslr$%s:%s@%s/%s?sslmode=disable&connect_timeout=10&options=sts_token=%s",
d.Ak.AccesskeyId, d.Ak.AccesskeySecret, d.PublicAddress, d.Database, url.QueryEscape(d.Token))
d.Ak.AccesskeyId, d.Ak.AccesskeySecret, d.PublicAddress, d.Database, url.QueryEscape(d.Ak.SecurityToken))
} else {
DSN = fmt.Sprintf("postgres://%s:%s@%s/%s?sslmode=disable&connect_timeout=10",
d.Ak.AccesskeyId, d.Ak.AccesskeySecret, d.PublicAddress, d.Database)
}
} else {
if d.Ak.SecurityToken != "" {
DSN = fmt.Sprintf("postgres://paifsslr$%s:%s@%s/%s?sslmode=disable&connect_timeout=10&options=sts_token=%s",
d.Ak.AccesskeyId, d.Ak.AccesskeySecret, d.PublicAddress, d.Database, url.QueryEscape(d.Token))
d.Ak.AccesskeyId, d.Ak.AccesskeySecret, d.PublicAddress, d.Database, url.QueryEscape(d.Ak.SecurityToken))
} else {
DSN = fmt.Sprintf("postgres://%s:%s@%s/%s?sslmode=disable&connect_timeout=10",
d.Ak.AccesskeyId, d.Ak.AccesskeySecret, d.VpcAddress, d.Database)
Expand Down

0 comments on commit 5068426

Please sign in to comment.