solution: config option to disable an upstream
This commit is contained in:
@@ -616,6 +616,11 @@ Fallback role mean that the upstream is used only after other upstreams failed o
|
|||||||
Cluster may have multiple upstreams for a single blockchain.
|
Cluster may have multiple upstreams for a single blockchain.
|
||||||
Accepted types: `bitcoin`, `bitcoin-testnet`, `ethereum`, `ethereum-classic`, `kovan-testnet`, `rinkeby-testnet`, `ropsten-testnet`, or `goerli-testnet`
|
Accepted types: `bitcoin`, `bitcoin-testnet`, `ethereum`, `ethereum-classic`, `kovan-testnet`, `rinkeby-testnet`, `ropsten-testnet`, or `goerli-testnet`
|
||||||
|
|
||||||
|
| `enabled`
|
||||||
|
| no
|
||||||
|
| `true` (default) or `false`.
|
||||||
|
Enable/disable the upstream.
|
||||||
|
|
||||||
| `labels`
|
| `labels`
|
||||||
| no
|
| no
|
||||||
| Key-Value pairs that are assigned to the upstream.
|
| Key-Value pairs that are assigned to the upstream.
|
||||||
|
|||||||
@@ -194,6 +194,9 @@ class UpstreamsConfigReader(
|
|||||||
upstream.id = getValueAsString(upNode, "id")
|
upstream.id = getValueAsString(upNode, "id")
|
||||||
upstream.options = tryReadOptions(upNode)
|
upstream.options = tryReadOptions(upNode)
|
||||||
upstream.methods = tryReadMethods(upNode)
|
upstream.methods = tryReadMethods(upNode)
|
||||||
|
getValueAsBool(upNode, "enabled")?.let {
|
||||||
|
upstream.isEnabled = it
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun readUpstreamGrpc(
|
internal fun readUpstreamGrpc(
|
||||||
|
|||||||
@@ -63,6 +63,10 @@ open class ConfiguredUpstreams(
|
|||||||
log.debug("Starting upstreams")
|
log.debug("Starting upstreams")
|
||||||
val defaultOptions = buildDefaultOptions(config)
|
val defaultOptions = buildDefaultOptions(config)
|
||||||
config.upstreams.forEach { up ->
|
config.upstreams.forEach { up ->
|
||||||
|
if (!up.isEnabled) {
|
||||||
|
log.debug("Upstream ${up.id} is disabled")
|
||||||
|
return@forEach
|
||||||
|
}
|
||||||
log.debug("Start upstream ${up.id}")
|
log.debug("Start upstream ${up.id}")
|
||||||
if (up.connection is UpstreamsConfig.GrpcConnection) {
|
if (up.connection is UpstreamsConfig.GrpcConnection) {
|
||||||
val options = up.options ?: UpstreamsConfig.Options()
|
val options = up.options ?: UpstreamsConfig.Options()
|
||||||
|
|||||||
Reference in New Issue
Block a user