mirror of
https://github.com/bitcoin-s/bitcoin-s.git
synced 2025-01-19 14:43:57 +01:00
Fix rpc bind address from config (#2542)
* Fix rpc bind address from config * Add to oracle server
This commit is contained in:
parent
906387c469
commit
09937e6ecf
@ -15,6 +15,11 @@ class OracleServerMain(override val args: Array[String])
|
||||
implicit val conf: DLCOracleAppConfig =
|
||||
DLCOracleAppConfig(datadir, baseConfig)
|
||||
|
||||
val bindConfOpt = rpcBindOpt match {
|
||||
case Some(rpcbind) => Some(rpcbind)
|
||||
case None => conf.rpcBindOpt
|
||||
}
|
||||
|
||||
for {
|
||||
_ <- conf.start()
|
||||
oracle <- conf.initialize()
|
||||
@ -24,17 +29,17 @@ class OracleServerMain(override val args: Array[String])
|
||||
case Some(rpcport) =>
|
||||
Server(conf = conf,
|
||||
handlers = routes,
|
||||
rpcbindOpt = rpcBindOpt,
|
||||
rpcbindOpt = bindConfOpt,
|
||||
rpcport = rpcport)
|
||||
case None =>
|
||||
conf.rpcPortOpt match {
|
||||
case Some(rpcport) =>
|
||||
Server(conf = conf,
|
||||
handlers = routes,
|
||||
rpcbindOpt = rpcBindOpt,
|
||||
rpcbindOpt = bindConfOpt,
|
||||
rpcport = rpcport)
|
||||
case None =>
|
||||
Server(conf = conf, handlers = routes, rpcbindOpt = rpcBindOpt)
|
||||
Server(conf = conf, handlers = routes, rpcbindOpt = bindConfOpt)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -74,6 +74,14 @@ case class BitcoinSAppConfig(
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
def rpcBindOpt: Option[String] = {
|
||||
if (config.hasPath("bitcoin-s.server.rpcbind")) {
|
||||
Some(config.getString("bitcoin-s.server.rpcbind"))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -286,13 +286,19 @@ class BitcoinSServerMain(override val args: Array[String])
|
||||
val nodeRoutes = NodeRoutes(nodeApi)
|
||||
val chainRoutes = ChainRoutes(chainApi, nodeConf.network)
|
||||
val coreRoutes = CoreRoutes(Core)
|
||||
|
||||
val bindConfOpt = rpcbindOpt match {
|
||||
case Some(rpcbind) => Some(rpcbind)
|
||||
case None => conf.rpcBindOpt
|
||||
}
|
||||
|
||||
val server = {
|
||||
rpcPortOpt match {
|
||||
case Some(rpcport) =>
|
||||
Server(conf = nodeConf,
|
||||
handlers =
|
||||
Seq(walletRoutes, nodeRoutes, chainRoutes, coreRoutes),
|
||||
rpcbindOpt = rpcbindOpt,
|
||||
rpcbindOpt = bindConfOpt,
|
||||
rpcport = rpcport)
|
||||
case None =>
|
||||
conf.rpcPortOpt match {
|
||||
@ -300,13 +306,13 @@ class BitcoinSServerMain(override val args: Array[String])
|
||||
Server(conf = nodeConf,
|
||||
handlers =
|
||||
Seq(walletRoutes, nodeRoutes, chainRoutes, coreRoutes),
|
||||
rpcbindOpt = rpcbindOpt,
|
||||
rpcbindOpt = bindConfOpt,
|
||||
rpcport = rpcport)
|
||||
case None =>
|
||||
Server(conf = nodeConf,
|
||||
handlers =
|
||||
Seq(walletRoutes, nodeRoutes, chainRoutes, coreRoutes),
|
||||
rpcbindOpt = rpcbindOpt)
|
||||
rpcbindOpt = bindConfOpt)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -100,6 +100,14 @@ case class DLCOracleAppConfig(
|
||||
}
|
||||
}
|
||||
|
||||
def rpcBindOpt: Option[String] = {
|
||||
if (config.hasPath("bitcoin-s.server.rpcbind")) {
|
||||
Some(config.getString("bitcoin-s.server.rpcbind"))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
lazy val kmParams: KeyManagerParams =
|
||||
KeyManagerParams(kmConf.seedPath,
|
||||
HDPurpose(DLCOracle.R_VALUE_PURPOSE),
|
||||
|
Loading…
Reference in New Issue
Block a user