refactoring
This commit is contained in:
@@ -1,14 +1,8 @@
|
|||||||
package io.emeraldpay.dshackle.config
|
package io.emeraldpay.dshackle.config
|
||||||
|
|
||||||
import org.slf4j.LoggerFactory
|
|
||||||
import org.yaml.snakeyaml.nodes.MappingNode
|
import org.yaml.snakeyaml.nodes.MappingNode
|
||||||
|
|
||||||
class AccessLogReader : YamlConfigReader(), ConfigReader<AccessLogConfig> {
|
class AccessLogReader : YamlConfigReader<AccessLogConfig>() {
|
||||||
|
|
||||||
companion object {
|
|
||||||
private val log = LoggerFactory.getLogger(AccessLogReader::class.java)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun read(input: MappingNode?): AccessLogConfig {
|
override fun read(input: MappingNode?): AccessLogConfig {
|
||||||
return getMapping(input, "accessLog")?.let { node ->
|
return getMapping(input, "accessLog")?.let { node ->
|
||||||
val enabled = getValueAsBool(node, "enabled") ?: false
|
val enabled = getValueAsBool(node, "enabled") ?: false
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ package io.emeraldpay.dshackle.config
|
|||||||
import org.slf4j.LoggerFactory
|
import org.slf4j.LoggerFactory
|
||||||
import org.yaml.snakeyaml.nodes.MappingNode
|
import org.yaml.snakeyaml.nodes.MappingNode
|
||||||
|
|
||||||
class AuthConfigReader : YamlConfigReader() {
|
class AuthConfigReader : YamlConfigReader<AuthConfig>() {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private val log = LoggerFactory.getLogger(AuthConfigReader::class.java)
|
private val log = LoggerFactory.getLogger(AuthConfigReader::class.java)
|
||||||
@@ -82,4 +82,8 @@ class AuthConfigReader : YamlConfigReader() {
|
|||||||
auth
|
auth
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun read(input: MappingNode?): AuthConfig? {
|
||||||
|
return null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,19 +17,13 @@ package io.emeraldpay.dshackle.config
|
|||||||
|
|
||||||
import org.slf4j.LoggerFactory
|
import org.slf4j.LoggerFactory
|
||||||
import org.yaml.snakeyaml.nodes.MappingNode
|
import org.yaml.snakeyaml.nodes.MappingNode
|
||||||
import java.io.InputStream
|
|
||||||
|
|
||||||
class CacheConfigReader : YamlConfigReader(), ConfigReader<CacheConfig> {
|
class CacheConfigReader : YamlConfigReader<CacheConfig>() {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private val log = LoggerFactory.getLogger(CacheConfigReader::class.java)
|
private val log = LoggerFactory.getLogger(CacheConfigReader::class.java)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun read(input: InputStream): CacheConfig? {
|
|
||||||
val configNode = readNode(input)
|
|
||||||
return read(configNode)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun read(input: MappingNode?): CacheConfig? {
|
override fun read(input: MappingNode?): CacheConfig? {
|
||||||
return getMapping(input, "cache")?.let { node ->
|
return getMapping(input, "cache")?.let { node ->
|
||||||
val config = CacheConfig()
|
val config = CacheConfig()
|
||||||
|
|||||||
@@ -1,11 +1,19 @@
|
|||||||
package io.emeraldpay.dshackle.config
|
package io.emeraldpay.dshackle.config
|
||||||
|
|
||||||
import io.emeraldpay.dshackle.Chain
|
import io.emeraldpay.dshackle.Chain
|
||||||
|
import java.lang.IllegalStateException
|
||||||
|
|
||||||
class ChainsConfig(var chains: Map<Chain, ChainConfig>, val currentDefault: ChainConfig) {
|
class ChainsConfig(private val chains: Map<Chain, RawChainConfig>?, val currentDefault: RawChainConfig?) {
|
||||||
companion object {
|
companion object {
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun default(): ChainsConfig = ChainsConfig(emptyMap(), ChainConfig.default())
|
fun default(): ChainsConfig = ChainsConfig(emptyMap(), RawChainConfig.default())
|
||||||
|
}
|
||||||
|
|
||||||
|
data class RawChainConfig(val syncingLagSize: Int?, val laggingLagSize: Int?) {
|
||||||
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
|
fun default() = RawChainConfig(6, 1)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
data class ChainConfig(val syncingLagSize: Int, val laggingLagSize: Int) {
|
data class ChainConfig(val syncingLagSize: Int, val laggingLagSize: Int) {
|
||||||
@@ -15,5 +23,15 @@ class ChainsConfig(var chains: Map<Chain, ChainConfig>, val currentDefault: Chai
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun resolve(chain: Chain) = chains[chain] ?: currentDefault
|
fun resolve(chain: Chain): ChainConfig {
|
||||||
|
val default = currentDefault ?: panic()
|
||||||
|
val raw = chains?.get(chain) ?: default
|
||||||
|
|
||||||
|
return ChainConfig(
|
||||||
|
laggingLagSize = raw.laggingLagSize ?: default.laggingLagSize ?: panic(),
|
||||||
|
syncingLagSize = raw.syncingLagSize ?: default.syncingLagSize ?: panic(),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun panic(): Nothing = throw IllegalStateException("Chains settings state is illegal - default config is null")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,43 +3,48 @@ package io.emeraldpay.dshackle.config
|
|||||||
import io.emeraldpay.dshackle.Global
|
import io.emeraldpay.dshackle.Global
|
||||||
import org.yaml.snakeyaml.nodes.CollectionNode
|
import org.yaml.snakeyaml.nodes.CollectionNode
|
||||||
import org.yaml.snakeyaml.nodes.MappingNode
|
import org.yaml.snakeyaml.nodes.MappingNode
|
||||||
import java.io.InputStream
|
|
||||||
|
|
||||||
class ChainsConfigReader : YamlConfigReader(), ConfigReader<ChainsConfig> {
|
class ChainsConfigReader : YamlConfigReader<ChainsConfig>() {
|
||||||
|
|
||||||
fun read(input: InputStream): ChainsConfig {
|
|
||||||
val configNode = readNode(input)
|
|
||||||
return read(configNode)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun read(input: MappingNode?): ChainsConfig {
|
override fun read(input: MappingNode?): ChainsConfig {
|
||||||
val chains = getList<MappingNode>(input, "chains")?.let {
|
return getMapping(input, "chain-settings")?.let {
|
||||||
readChains(it)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (chains == null) {
|
val chains = getList<MappingNode>(it, "chains")?.let {
|
||||||
return ChainsConfig.default()
|
readChains(it)
|
||||||
} else {
|
}
|
||||||
|
|
||||||
val default = chains.firstOrNull { it.first == "default" }?.second ?: ChainsConfig.ChainConfig.default()
|
val default = getMapping(it, "default")?.let {
|
||||||
|
readChain(it)
|
||||||
|
}
|
||||||
|
|
||||||
return ChainsConfig(
|
return ChainsConfig(
|
||||||
chains.filter { it.first != "default" }
|
chains
|
||||||
.map { Global.chainById(it.first) to it.second }
|
?.map { Global.chainById(it.first) to it.second }
|
||||||
.associateBy({ it.first }, { it.second }),
|
?.associateBy({ it.first }, { it.second }) ?: emptyMap(),
|
||||||
default
|
default
|
||||||
)
|
)
|
||||||
|
} ?: ChainsConfig.default()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun readChain(node: MappingNode): ChainsConfig.RawChainConfig? {
|
||||||
|
return getMapping(node, "lags")?.let {
|
||||||
|
return ChainsConfig.RawChainConfig(
|
||||||
|
getValueAsInt(it, "syncing"),
|
||||||
|
getValueAsInt(it, "lagging")
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun readChains(node: CollectionNode<MappingNode>): List<Pair<String, ChainsConfig.ChainConfig>> {
|
private fun readChains(node: CollectionNode<MappingNode>): List<Pair<String, ChainsConfig.RawChainConfig>> {
|
||||||
return node.value.map {
|
return node.value.mapNotNull {
|
||||||
val key = getValueAsString(it, "name") ?: throw IllegalArgumentException()
|
val key = getValueAsString(it, "name")
|
||||||
val value = ChainsConfig.ChainConfig(
|
?: throw InvalidConfigYamlException(filename, it.startMark, "chain name required")
|
||||||
getValueAsInt(it, "syncing-size") ?: throw IllegalArgumentException(),
|
val value = readChain(it)
|
||||||
getValueAsInt(it, "lagging-size") ?: throw IllegalArgumentException()
|
if (value != null) {
|
||||||
)
|
return@mapNotNull key to value
|
||||||
key to value
|
} else {
|
||||||
|
return@mapNotNull null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,8 @@
|
|||||||
package io.emeraldpay.dshackle.config
|
package io.emeraldpay.dshackle.config
|
||||||
|
|
||||||
import org.yaml.snakeyaml.nodes.MappingNode
|
import org.yaml.snakeyaml.nodes.MappingNode
|
||||||
import java.io.InputStream
|
|
||||||
|
|
||||||
class CompressionConfigReader : YamlConfigReader(), ConfigReader<CompressionConfig> {
|
|
||||||
fun read(input: InputStream): CompressionConfig? {
|
|
||||||
val configNode = readNode(input)
|
|
||||||
return read(configNode)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
class CompressionConfigReader : YamlConfigReader<CompressionConfig>() {
|
||||||
override fun read(input: MappingNode?): CompressionConfig {
|
override fun read(input: MappingNode?): CompressionConfig {
|
||||||
val config = CompressionConfig()
|
val config = CompressionConfig()
|
||||||
getMapping(input, "compression")?.let { node ->
|
getMapping(input, "compression")?.let { node ->
|
||||||
|
|||||||
@@ -20,19 +20,13 @@ import io.emeraldpay.dshackle.Global
|
|||||||
import org.slf4j.LoggerFactory
|
import org.slf4j.LoggerFactory
|
||||||
import org.yaml.snakeyaml.nodes.CollectionNode
|
import org.yaml.snakeyaml.nodes.CollectionNode
|
||||||
import org.yaml.snakeyaml.nodes.MappingNode
|
import org.yaml.snakeyaml.nodes.MappingNode
|
||||||
import java.io.InputStream
|
|
||||||
|
|
||||||
class HealthConfigReader : YamlConfigReader(), ConfigReader<HealthConfig> {
|
class HealthConfigReader : YamlConfigReader<HealthConfig>() {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private val log = LoggerFactory.getLogger(HealthConfigReader::class.java)
|
private val log = LoggerFactory.getLogger(HealthConfigReader::class.java)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun read(input: InputStream): HealthConfig {
|
|
||||||
val configNode = readNode(input)
|
|
||||||
return read(configNode)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun read(input: MappingNode?): HealthConfig {
|
override fun read(input: MappingNode?): HealthConfig {
|
||||||
return readInternal(getMapping(input, "health"))
|
return readInternal(getMapping(input, "health"))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,11 +18,10 @@ package io.emeraldpay.dshackle.config
|
|||||||
import io.emeraldpay.dshackle.FileResolver
|
import io.emeraldpay.dshackle.FileResolver
|
||||||
import org.slf4j.LoggerFactory
|
import org.slf4j.LoggerFactory
|
||||||
import org.yaml.snakeyaml.nodes.MappingNode
|
import org.yaml.snakeyaml.nodes.MappingNode
|
||||||
import java.io.InputStream
|
|
||||||
|
|
||||||
class MainConfigReader(
|
class MainConfigReader(
|
||||||
fileResolver: FileResolver
|
fileResolver: FileResolver
|
||||||
) : YamlConfigReader(), ConfigReader<MainConfig> {
|
) : YamlConfigReader<MainConfig>() {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private val log = LoggerFactory.getLogger(MainConfigReader::class.java)
|
private val log = LoggerFactory.getLogger(MainConfigReader::class.java)
|
||||||
@@ -40,11 +39,6 @@ class MainConfigReader(
|
|||||||
private val compressionConfigReader = CompressionConfigReader()
|
private val compressionConfigReader = CompressionConfigReader()
|
||||||
private val chainsConfigReader = ChainsConfigReader()
|
private val chainsConfigReader = ChainsConfigReader()
|
||||||
|
|
||||||
fun read(input: InputStream): MainConfig? {
|
|
||||||
val configNode = readNode(input)
|
|
||||||
return read(configNode)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun read(input: MappingNode?): MainConfig? {
|
override fun read(input: MappingNode?): MainConfig? {
|
||||||
val config = MainConfig()
|
val config = MainConfig()
|
||||||
getValueAsString(input, "host")?.let {
|
getValueAsString(input, "host")?.let {
|
||||||
|
|||||||
@@ -15,21 +15,9 @@
|
|||||||
*/
|
*/
|
||||||
package io.emeraldpay.dshackle.config
|
package io.emeraldpay.dshackle.config
|
||||||
|
|
||||||
import org.slf4j.LoggerFactory
|
|
||||||
import org.yaml.snakeyaml.nodes.MappingNode
|
import org.yaml.snakeyaml.nodes.MappingNode
|
||||||
import java.io.InputStream
|
|
||||||
|
|
||||||
class MonitoringConfigReader : YamlConfigReader(), ConfigReader<MonitoringConfig> {
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
private val log = LoggerFactory.getLogger(MonitoringConfigReader::class.java)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun read(input: InputStream): MonitoringConfig {
|
|
||||||
val configNode = readNode(input)
|
|
||||||
return read(configNode)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
class MonitoringConfigReader : YamlConfigReader<MonitoringConfig>() {
|
||||||
override fun read(input: MappingNode?): MonitoringConfig {
|
override fun read(input: MappingNode?): MonitoringConfig {
|
||||||
return readInternal(getMapping(input, "monitoring"))
|
return readInternal(getMapping(input, "monitoring"))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,25 +21,18 @@ import io.emeraldpay.dshackle.Global
|
|||||||
import org.apache.commons.lang3.StringUtils
|
import org.apache.commons.lang3.StringUtils
|
||||||
import org.slf4j.LoggerFactory
|
import org.slf4j.LoggerFactory
|
||||||
import org.yaml.snakeyaml.nodes.MappingNode
|
import org.yaml.snakeyaml.nodes.MappingNode
|
||||||
import java.io.InputStream
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read YAML config, part related to Proxy configuration
|
* Read YAML config, part related to Proxy configuration
|
||||||
*/
|
*/
|
||||||
class ProxyConfigReader : YamlConfigReader(), ConfigReader<ProxyConfig> {
|
class ProxyConfigReader : YamlConfigReader<ProxyConfig>() {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private val log = LoggerFactory.getLogger(ProxyConfigReader::class.java)
|
private val log = LoggerFactory.getLogger(ProxyConfigReader::class.java)
|
||||||
}
|
}
|
||||||
|
|
||||||
private var filename = "dshackle.yaml"
|
|
||||||
private val authConfigReader = AuthConfigReader()
|
private val authConfigReader = AuthConfigReader()
|
||||||
|
|
||||||
fun read(input: InputStream): ProxyConfig? {
|
|
||||||
val configNode = readNode(input)
|
|
||||||
return read(configNode)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun read(input: MappingNode?): ProxyConfig? {
|
override fun read(input: MappingNode?): ProxyConfig? {
|
||||||
return readInternal(getMapping(input, "proxy"))
|
return readInternal(getMapping(input, "proxy"))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,21 +1,9 @@
|
|||||||
package io.emeraldpay.dshackle.config
|
package io.emeraldpay.dshackle.config
|
||||||
|
|
||||||
import io.emeraldpay.dshackle.FileResolver
|
import io.emeraldpay.dshackle.FileResolver
|
||||||
import org.slf4j.LoggerFactory
|
|
||||||
import org.yaml.snakeyaml.nodes.MappingNode
|
import org.yaml.snakeyaml.nodes.MappingNode
|
||||||
import java.io.InputStream
|
|
||||||
|
|
||||||
class SignatureConfigReader(val fileResolver: FileResolver) : YamlConfigReader(), ConfigReader<SignatureConfig> {
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
private val log = LoggerFactory.getLogger(SignatureConfig::class.java)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun read(input: InputStream): SignatureConfig? {
|
|
||||||
val configNode = readNode(input)
|
|
||||||
return read(configNode)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
class SignatureConfigReader(val fileResolver: FileResolver) : YamlConfigReader<SignatureConfig>() {
|
||||||
override fun read(input: MappingNode?): SignatureConfig? {
|
override fun read(input: MappingNode?): SignatureConfig? {
|
||||||
return getMapping(input, "signed-response")?.let { node ->
|
return getMapping(input, "signed-response")?.let { node ->
|
||||||
val config = SignatureConfig()
|
val config = SignatureConfig()
|
||||||
|
|||||||
@@ -18,18 +18,12 @@ package io.emeraldpay.dshackle.config
|
|||||||
import io.emeraldpay.dshackle.Global
|
import io.emeraldpay.dshackle.Global
|
||||||
import org.slf4j.LoggerFactory
|
import org.slf4j.LoggerFactory
|
||||||
import org.yaml.snakeyaml.nodes.MappingNode
|
import org.yaml.snakeyaml.nodes.MappingNode
|
||||||
import java.io.InputStream
|
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
|
|
||||||
class TokensConfigReader : YamlConfigReader(), ConfigReader<TokensConfig> {
|
class TokensConfigReader : YamlConfigReader<TokensConfig>() {
|
||||||
|
|
||||||
private val log = LoggerFactory.getLogger(TokensConfigReader::class.java)
|
private val log = LoggerFactory.getLogger(TokensConfigReader::class.java)
|
||||||
|
|
||||||
fun read(input: InputStream): TokensConfig? {
|
|
||||||
val configNode = readNode(input)
|
|
||||||
return read(configNode)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun read(input: MappingNode?): TokensConfig? {
|
override fun read(input: MappingNode?): TokensConfig? {
|
||||||
val tokens = getList<MappingNode>(input, "tokens")?.value?.map { node ->
|
val tokens = getList<MappingNode>(input, "tokens")?.value?.map { node ->
|
||||||
val token = TokensConfig.Token()
|
val token = TokensConfig.Token()
|
||||||
|
|||||||
@@ -20,31 +20,25 @@ import io.emeraldpay.dshackle.FileResolver
|
|||||||
import org.apache.commons.lang3.StringUtils
|
import org.apache.commons.lang3.StringUtils
|
||||||
import org.slf4j.LoggerFactory
|
import org.slf4j.LoggerFactory
|
||||||
import org.yaml.snakeyaml.nodes.MappingNode
|
import org.yaml.snakeyaml.nodes.MappingNode
|
||||||
import java.io.InputStream
|
|
||||||
import java.net.URI
|
import java.net.URI
|
||||||
import java.time.Duration
|
import java.time.Duration
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
|
|
||||||
class UpstreamsConfigReader(
|
class UpstreamsConfigReader(
|
||||||
private val fileResolver: FileResolver
|
private val fileResolver: FileResolver
|
||||||
) : YamlConfigReader(), ConfigReader<UpstreamsConfig> {
|
) : YamlConfigReader<UpstreamsConfig>() {
|
||||||
|
|
||||||
private val log = LoggerFactory.getLogger(UpstreamsConfigReader::class.java)
|
private val log = LoggerFactory.getLogger(UpstreamsConfigReader::class.java)
|
||||||
private val authConfigReader = AuthConfigReader()
|
private val authConfigReader = AuthConfigReader()
|
||||||
private val knownNodeIds: MutableSet<Int> = HashSet()
|
private val knownNodeIds: MutableSet<Int> = HashSet()
|
||||||
|
|
||||||
fun read(input: InputStream): UpstreamsConfig? {
|
|
||||||
val configNode = readNode(input)
|
|
||||||
return readInternal(configNode)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun read(input: MappingNode?): UpstreamsConfig? {
|
override fun read(input: MappingNode?): UpstreamsConfig? {
|
||||||
return getMapping(input, "cluster")?.let {
|
return getMapping(input, "cluster")?.let {
|
||||||
readInternal(it)
|
readInternal(it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun readInternal(input: MappingNode?): UpstreamsConfig? {
|
fun readInternal(input: MappingNode?): UpstreamsConfig {
|
||||||
val config = UpstreamsConfig()
|
val config = UpstreamsConfig()
|
||||||
|
|
||||||
getList<MappingNode>(input, "defaults")?.value?.forEach { opts ->
|
getList<MappingNode>(input, "defaults")?.value?.forEach { opts ->
|
||||||
|
|||||||
@@ -25,9 +25,15 @@ import java.io.InputStream
|
|||||||
import java.io.InputStreamReader
|
import java.io.InputStreamReader
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
|
|
||||||
abstract class YamlConfigReader {
|
abstract class YamlConfigReader<T> : ConfigReader<T> {
|
||||||
private val envVariables = EnvVariables()
|
private val envVariables = EnvVariables()
|
||||||
|
|
||||||
|
val filename = "dshackle.yaml"
|
||||||
|
|
||||||
|
fun read(input: InputStream): T? {
|
||||||
|
val configNode = readNode(input)
|
||||||
|
return read(configNode)
|
||||||
|
}
|
||||||
fun readNode(input: String): MappingNode {
|
fun readNode(input: String): MappingNode {
|
||||||
return readNode(input.byteInputStream())
|
return readNode(input.byteInputStream())
|
||||||
}
|
}
|
||||||
|
|||||||
16
src/main/resources/chains.yaml
Normal file
16
src/main/resources/chains.yaml
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
version: v1
|
||||||
|
|
||||||
|
chain-settings:
|
||||||
|
default:
|
||||||
|
lags:
|
||||||
|
syncing: 6
|
||||||
|
lagging: 1
|
||||||
|
chains:
|
||||||
|
- id: eth
|
||||||
|
lags:
|
||||||
|
syncing: 6
|
||||||
|
lagging: 1
|
||||||
|
- name: polygon
|
||||||
|
lags:
|
||||||
|
syncing: 20
|
||||||
|
lagging: 10
|
||||||
@@ -15,6 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
package io.emeraldpay.dshackle.config
|
package io.emeraldpay.dshackle.config
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.Nullable
|
||||||
import org.yaml.snakeyaml.Yaml
|
import org.yaml.snakeyaml.Yaml
|
||||||
import org.yaml.snakeyaml.nodes.MappingNode
|
import org.yaml.snakeyaml.nodes.MappingNode
|
||||||
import spock.lang.Specification
|
import spock.lang.Specification
|
||||||
@@ -41,5 +42,10 @@ class YamlConfigReaderSpec extends Specification {
|
|||||||
return new Yaml().compose(new StringReader("$key: $value")) as MappingNode
|
return new Yaml().compose(new StringReader("$key: $value")) as MappingNode
|
||||||
}
|
}
|
||||||
|
|
||||||
class Impl extends YamlConfigReader {}
|
class Impl extends YamlConfigReader {
|
||||||
|
@Override
|
||||||
|
Object read(@Nullable MappingNode input) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,12 @@
|
|||||||
version: v1
|
version: v1
|
||||||
|
|
||||||
chains:
|
chain-settings:
|
||||||
- name: eth
|
default:
|
||||||
syncing-size: 10
|
lags:
|
||||||
lagging-size: 5
|
syncing: 6
|
||||||
|
lagging: 1
|
||||||
|
chains:
|
||||||
|
- id: eth
|
||||||
|
lags:
|
||||||
|
syncing: 6
|
||||||
|
lagging: 1
|
||||||
|
|||||||
Reference in New Issue
Block a user