Browse Source

server: Add the genesis block to the config file

prometheus-integration
Adinael Perez Ruelas 6 years ago
committed by Alexis Hernandez
parent
commit
117a66869b
  1. 21
      server/app/com/xsn/explorer/config/ExplorerConfig.scala
  2. 1
      server/app/com/xsn/explorer/modules/ConfigModule.scala
  3. 4
      server/conf/application.conf

21
server/app/com/xsn/explorer/config/ExplorerConfig.scala

@ -0,0 +1,21 @@
package com.xsn.explorer.config
import com.xsn.explorer.models.Blockhash
import javax.inject.Inject
import play.api.Configuration
trait ExplorerConfig {
def genesisBlock: Blockhash
}
class PlayExplorerConfig @Inject() (config: Configuration) extends ExplorerConfig {
override val genesisBlock: Blockhash = {
Blockhash
.from(config.get[String]("explorer.genesisBlock"))
.getOrElse(throw new RuntimeException("The given genesisBlock is incorrect"))
}
}

1
server/app/com/xsn/explorer/modules/ConfigModule.scala

@ -8,5 +8,6 @@ class ConfigModule extends AbstractModule {
override def configure(): Unit = { override def configure(): Unit = {
bind(classOf[RPCConfig]).to(classOf[PlayRPCConfig]) bind(classOf[RPCConfig]).to(classOf[PlayRPCConfig])
bind(classOf[LedgerSynchronizerConfig]).to(classOf[LedgerSynchronizerPlayConfig]) bind(classOf[LedgerSynchronizerConfig]).to(classOf[LedgerSynchronizerPlayConfig])
bind(classOf[ExplorerConfig]).to(classOf[PlayExplorerConfig])
} }
} }

4
server/conf/application.conf

@ -102,3 +102,7 @@ externalService.dispatcher {
fixed-pool-size = 50 fixed-pool-size = 50
} }
} }
explorer {
genesisBlock = "00000c822abdbb23e28f79a49d29b41429737c6c7e15df40d1b1f1b35907ae34"
}

Loading…
Cancel
Save