mirror of
https://github.com/bitcoin-s/bitcoin-s.git
synced 2025-03-26 21:42:48 +01:00
Version Number in logs & Cli Command (#2467)
This commit is contained in:
parent
cc2c438da1
commit
fb43748d97
3 changed files with 17 additions and 1 deletions
|
@ -21,6 +21,7 @@ import org.bitcoins.core.protocol.transaction.{
|
|||
}
|
||||
import org.bitcoins.core.protocol.{BitcoinAddress, BlockStamp}
|
||||
import org.bitcoins.core.psbt.PSBT
|
||||
import org.bitcoins.core.util.EnvUtil
|
||||
import org.bitcoins.core.wallet.fee.SatoshisPerVirtualByte
|
||||
import org.bitcoins.core.wallet.utxo.AddressLabelTag
|
||||
import org.bitcoins.crypto.{
|
||||
|
@ -54,6 +55,9 @@ object ConsoleCli {
|
|||
opt[Int]("rpcport")
|
||||
.action((port, conf) => conf.copy(rpcPort = port))
|
||||
.text(s"The port to send our rpc request to on the server"),
|
||||
opt[Unit]("version")
|
||||
.action((_, conf) => conf.copy(command = GetVersion))
|
||||
.hidden(),
|
||||
help('h', "help").text("Display this help message and exit"),
|
||||
note(sys.props("line.separator") + "Commands:"),
|
||||
note(sys.props("line.separator") + "===Blockchain ==="),
|
||||
|
@ -1604,6 +1608,10 @@ object ConsoleCli {
|
|||
case GetSignatures(tlv) =>
|
||||
RequestParam("getsignatures", Seq(up.writeJs(tlv)))
|
||||
|
||||
case GetVersion =>
|
||||
// skip sending to server and just return version number of cli
|
||||
return Success(EnvUtil.getVersion)
|
||||
|
||||
case NoCommand => ???
|
||||
}
|
||||
|
||||
|
@ -1708,6 +1716,10 @@ object CliCommand {
|
|||
def noBroadcast: Boolean
|
||||
}
|
||||
|
||||
sealed trait ServerlessCliCommand extends CliCommand
|
||||
|
||||
case object GetVersion extends ServerlessCliCommand
|
||||
|
||||
case object GetInfo extends CliCommand
|
||||
|
||||
// DLC
|
||||
|
|
|
@ -3,7 +3,7 @@ package org.bitcoins.server.routes
|
|||
import akka.actor.ActorSystem
|
||||
import com.typesafe.config.{Config, ConfigFactory}
|
||||
import org.bitcoins.core.config._
|
||||
import org.bitcoins.core.util.BitcoinSLogger
|
||||
import org.bitcoins.core.util.{BitcoinSLogger, EnvUtil}
|
||||
import org.bitcoins.db.AppConfig
|
||||
import org.bitcoins.db.AppConfig.safePathToString
|
||||
|
||||
|
@ -108,6 +108,8 @@ trait BitcoinSRunner extends BitcoinSLogger {
|
|||
datadir.resolve(lastDirname)
|
||||
}
|
||||
|
||||
logger.info(s"version=${EnvUtil.getVersion}")
|
||||
|
||||
// Properly set log location
|
||||
System.setProperty("bitcoins.log.location",
|
||||
networkDatadir.toAbsolutePath.toString)
|
||||
|
|
|
@ -12,4 +12,6 @@ object EnvUtil {
|
|||
lazy val isWindows: Boolean = osName.startsWith("Windows")
|
||||
|
||||
lazy val isCI: Boolean = Properties.envOrNone("CI").contains("true")
|
||||
|
||||
def getVersion: String = getClass.getPackage.getImplementationVersion
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue