Browse Source
Merge pull request #217 from lizhanfei/stepTwo
MayReplaceLocalhost替换127.0.0.1
pull/219/head
yedf2
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
3 additions and
1 deletions
-
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 |
|
|
|
} |
|
|
|
|