Add handling so test lnd clients can be reached by docker (#4729)

* Add handling to test lnd clients can be reached by docker

* Subsitute during config construction instead in call credentials
This commit is contained in:
benthecarman 2022-09-08 08:07:39 -05:00 committed by GitHub
parent 26595ab3ac
commit 8bbfbc89d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 6 deletions

View File

@ -101,12 +101,21 @@ case class LndConfig(private[bitcoins] val lines: Seq[String], datadir: File)
else "http://" + baseUrl
})
lazy val rpcBinding: URI = new URI({
lazy val rpcBinding: URI = {
val uri = new URI({
val baseUrl = getValue("rpclisten").getOrElse("127.0.0.1:10009")
if (baseUrl.startsWith("http")) baseUrl
else "http://" + baseUrl
})
// if our local lnd is bound to 0.0.0.0
// then we can just make requests to localhost
if (uri.getHost == "0.0.0.0") {
logger.warn("lnd rpc is bound to 0.0.0.0, using localhost instead")
new URI(s"http://127.0.0.1:${uri.getPort}")
} else uri
}
lazy val restBinding: URI = new URI({
val baseUrl = getValue("restlisten").getOrElse("127.0.0.1:8080")
if (baseUrl.startsWith("http")) baseUrl

View File

@ -79,7 +79,12 @@ trait LndRpcTestUtil extends Logging {
|historicalsyncinterval=1s
|trickledelay=1000
|listen=127.0.0.1:$port
|rpclisten=127.0.0.1:$rpcPort
|
|# allow requests from docker containers
|tlsextradomain=host.docker.internal
|tlsextradomain=host-gateway
|rpclisten=0.0.0.0:$rpcPort
|
|externalip=127.0.0.1
|maxpendingchannels=10
|bitcoind.rpcuser = ${bitcoindInstance.authCredentials