mirror of
https://github.com/bitcoin-s/bitcoin-s.git
synced 2025-02-20 13:44:59 +01:00
2020 02 21 datadir configurable (#1156)
* Make it so that you can pass in the datadir from the command line * Add example on website * implement ben's solution
This commit is contained in:
parent
89b8989b2f
commit
03cfbc0803
2 changed files with 19 additions and 2 deletions
|
@ -1,12 +1,13 @@
|
|||
package org.bitcoins.server
|
||||
|
||||
import java.net.InetSocketAddress
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.{Files, Paths}
|
||||
|
||||
import akka.actor.ActorSystem
|
||||
import org.bitcoins.chain.config.ChainAppConfig
|
||||
import org.bitcoins.core.Core
|
||||
import org.bitcoins.core.api.ChainQueryApi
|
||||
import org.bitcoins.db.AppConfig
|
||||
import org.bitcoins.keymanager.KeyManagerInitializeError
|
||||
import org.bitcoins.keymanager.bip39.BIP39KeyManager
|
||||
import org.bitcoins.node.config.NodeAppConfig
|
||||
|
@ -22,7 +23,18 @@ import scala.concurrent.duration._
|
|||
import scala.concurrent.{Await, Future}
|
||||
|
||||
object Main extends App {
|
||||
implicit val conf = BitcoinSAppConfig.fromDefaultDatadir()
|
||||
implicit val conf = {
|
||||
val dataDirIndexOpt = args.zipWithIndex
|
||||
.find(_._1.toLowerCase == "--datadir")
|
||||
|
||||
val datadirPath = dataDirIndexOpt match {
|
||||
case None => AppConfig.DEFAULT_BITCOIN_S_DATADIR
|
||||
case Some((_, dataDirIndex)) =>
|
||||
val str = args(dataDirIndex + 1)
|
||||
Paths.get(str)
|
||||
}
|
||||
BitcoinSAppConfig(datadirPath)
|
||||
}
|
||||
|
||||
private val logger = HttpLoggerImpl(conf.nodeConf).getLogger
|
||||
|
||||
|
|
|
@ -31,6 +31,11 @@ This will produce a script to execute bitcoin-s which you can start with
|
|||
$ ./app/server/target/universal/stage/bin/bitcoin-s-server
|
||||
```
|
||||
|
||||
If you would like to pass in a custom datadir for your server, you can do
|
||||
|
||||
```bash
|
||||
./app/server/target/universal/stage/bin/bitcoin-s-server --datadir /path/to/datadir/
|
||||
```
|
||||
For more information on configuring the server please see our [configuration](configuration.md) document
|
||||
|
||||
For more information on how to use our built in `cli` to interact with the server please see [cli.md](cli.md)
|
Loading…
Add table
Reference in a new issue