Skip to content

Commit

Permalink
server: Add the genesis block to the config file
Browse files Browse the repository at this point in the history
  • Loading branch information
adinael authored and AlexITC committed Nov 19, 2018
1 parent fa82993 commit 117a668
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
21 changes: 21 additions & 0 deletions server/app/com/xsn/explorer/config/ExplorerConfig.scala
Original file line number Diff line number Diff line change
@@ -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 change: 1 addition & 0 deletions server/app/com/xsn/explorer/modules/ConfigModule.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ class ConfigModule extends AbstractModule {
override def configure(): Unit = {
bind(classOf[RPCConfig]).to(classOf[PlayRPCConfig])
bind(classOf[LedgerSynchronizerConfig]).to(classOf[LedgerSynchronizerPlayConfig])
bind(classOf[ExplorerConfig]).to(classOf[PlayExplorerConfig])
}
}
4 changes: 4 additions & 0 deletions server/conf/application.conf
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,7 @@ externalService.dispatcher {
fixed-pool-size = 50
}
}

explorer {
genesisBlock = "00000c822abdbb23e28f79a49d29b41429737c6c7e15df40d1b1f1b35907ae34"
}

0 comments on commit 117a668

Please sign in to comment.