-
Notifications
You must be signed in to change notification settings - Fork 78
[ETCM-251] faucet healthcheck #768
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
9ca859e
init refactor
biandratti 95ac2d4
add refactor from JsonRpcController
biandratti 235fb7b
add refactor from JsonRpcController
biandratti 3e6390e
change rpc fuacet
biandratti 3da6e41
merge with develop
biandratti d828788
remove faucet api
biandratti 2a25139
change faucet config
biandratti 4d47de6
fix test
biandratti 3c41d96
change properties
biandratti 8a8c524
add new endpoints from faucet
biandratti bf14b14
remove config from limit request
biandratti 26886b8
change name from JsonRpcBaseController
biandratti d23da17
merge with develop
biandratti d6844bf
fix test
biandratti 1b5c3ec
change faucet implicits
biandratti 3f3f384
change monix task -- add now
biandratti 8f6522e
Merge branch 'develop' into ETCM-251-faucet-healthcheck
lemastero 3b537fd
remove configs from http
biandratti 31f3311
Merge branch 'ETCM-251-faucet-healthcheck' of github.com:input-output…
biandratti 297dc9e
fix test
biandratti 1fe63fc
change test
biandratti dfa90bb
Merge branch 'develop' of github.com:input-output-hk/mantis into ETCM…
biandratti File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,34 +1,13 @@ | ||
| package io.iohk.ethereum.faucet | ||
|
|
||
| import java.security.SecureRandom | ||
|
|
||
| import akka.actor.ActorSystem | ||
| import akka.http.scaladsl.Http | ||
| import com.typesafe.config.ConfigFactory | ||
| import io.iohk.ethereum.keystore.KeyStoreImpl | ||
| import io.iohk.ethereum.mallet.service.RpcClient | ||
| import io.iohk.ethereum.utils.{KeyStoreConfig, Logger} | ||
|
|
||
| import scala.concurrent.ExecutionContext.Implicits.global | ||
| import scala.util.{Failure, Success} | ||
| import io.iohk.ethereum.faucet.jsonrpc.FaucetServer | ||
| import io.iohk.ethereum.utils.Logger | ||
|
|
||
| object Faucet extends Logger { | ||
|
|
||
| def main(args: Array[String]): Unit = { | ||
| val config = FaucetConfig(ConfigFactory.load()) | ||
|
|
||
| implicit val system = ActorSystem("Faucet-system") | ||
|
|
||
| val keyStore = new KeyStoreImpl(KeyStoreConfig.customKeyStoreConfig(config.keyStoreDir), new SecureRandom()) | ||
| val rpcClient = new RpcClient(config.rpcAddress) | ||
| val api = new FaucetApi(rpcClient, keyStore, config) | ||
|
|
||
| val bindingResultF = Http().newServerAt(config.listenInterface, config.listenPort).bind(api.route) | ||
|
|
||
| bindingResultF onComplete { | ||
| case Success(serverBinding) => log.info(s"Faucet HTTP server listening on ${serverBinding.localAddress}") | ||
| case Failure(ex) => log.error("Cannot start faucet HTTP server", ex) | ||
| } | ||
| (new FaucetServer).start() | ||
| } | ||
|
|
||
| } |
This file was deleted.
Oops, something went wrong.
25 changes: 10 additions & 15 deletions
25
src/main/scala/io/iohk/ethereum/faucet/FaucetConfig.scala
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,45 +1,40 @@ | ||
| package io.iohk.ethereum.faucet | ||
|
|
||
| import ch.megard.akka.http.cors.scaladsl.model.HttpOriginMatcher | ||
| import com.typesafe.config.{Config => TypesafeConfig} | ||
| import com.typesafe.config.{ConfigFactory, Config => TypesafeConfig} | ||
| import io.iohk.ethereum.domain.Address | ||
| import io.iohk.ethereum.utils.ConfigUtils | ||
|
|
||
| import scala.concurrent.duration.{FiniteDuration, _} | ||
|
|
||
| trait FaucetConfigBuilder { | ||
| lazy val rawConfig: TypesafeConfig = ConfigFactory.load() | ||
| lazy val rawMantisConfig: TypesafeConfig = rawConfig.getConfig("mantis") | ||
| lazy val faucetConfig: FaucetConfig = FaucetConfig(rawConfig) | ||
| } | ||
|
|
||
| case class FaucetConfig( | ||
| walletAddress: Address, | ||
| walletPassword: String, | ||
| txGasPrice: BigInt, | ||
| txGasLimit: BigInt, | ||
| txValue: BigInt, | ||
| corsAllowedOrigins: HttpOriginMatcher, | ||
| rpcAddress: String, | ||
| keyStoreDir: String, | ||
| listenInterface: String, | ||
| listenPort: Int, | ||
| minRequestInterval: FiniteDuration, | ||
| latestTimestampCacheSize: Int | ||
| minRequestInterval: FiniteDuration | ||
| ) | ||
|
|
||
| object FaucetConfig { | ||
| def apply(typesafeConfig: TypesafeConfig): FaucetConfig = { | ||
| val faucetConfig = typesafeConfig.getConfig("faucet") | ||
|
|
||
| val corsAllowedOrigins = ConfigUtils.parseCorsAllowedOrigins(faucetConfig, "cors-allowed-origins") | ||
|
|
||
| FaucetConfig( | ||
| walletAddress = Address(faucetConfig.getString("wallet-address")), | ||
| walletPassword = faucetConfig.getString("wallet-password"), | ||
| txGasPrice = faucetConfig.getLong("tx-gas-price"), | ||
| txGasLimit = faucetConfig.getLong("tx-gas-limit"), | ||
| txValue = faucetConfig.getLong("tx-value"), | ||
| corsAllowedOrigins = corsAllowedOrigins, | ||
| rpcAddress = faucetConfig.getString("rpc-address"), | ||
| keyStoreDir = faucetConfig.getString("keystore-dir"), | ||
| listenInterface = faucetConfig.getString("listen-interface"), | ||
| listenPort = faucetConfig.getInt("listen-port"), | ||
| minRequestInterval = faucetConfig.getDuration("min-request-interval").toMillis.millis, | ||
| latestTimestampCacheSize = faucetConfig.getInt("latest-timestamp-cache-size") | ||
| minRequestInterval = faucetConfig.getDuration("min-request-interval").toMillis.millis | ||
| ) | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.