Browse Source

Merge pull request #217 from lizhanfei/stepTwo

MayReplaceLocalhost替换127.0.0.1
pull/219/head
yedf2 4 years ago
committed by GitHub
parent
commit
d0e7dad71a
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      dtmcli/dtmimp/utils.go

4
dtmcli/dtmimp/utils.go

@ -144,7 +144,9 @@ func GetFuncName() string {
// MayReplaceLocalhost when run in docker compose, change localhost to host.docker.internal for accessing host network
func MayReplaceLocalhost(host string) string {
if os.Getenv("IS_DOCKER") != "" {
return strings.Replace(host, "localhost", "host.docker.internal", 1)
return strings.Replace(strings.Replace(host,
"localhost", "host.docker.internal", 1),
"127.0.0.1", "host.docker.internal", 1)
}
return host
}

Loading…
Cancel
Save