mirror of
https://github.com/trezor/blockbook.git
synced 2026-02-19 16:31:19 +01:00
BB_RPC_URL_* -> BB_RPC_URL_HTTP_*
This commit is contained in:
2
Makefile
2
Makefile
@@ -8,7 +8,7 @@ TCMALLOC =
|
||||
PORTABLE = 0
|
||||
ARGS ?=
|
||||
# Forward BB_RPC_* overrides into Docker so template generation sees desired endpoints/binds/allow lists.
|
||||
BB_RPC_ENV := $(shell env | awk -F= '/^BB_RPC_(URL|URL_WS|BIND_HOST|ALLOW_IP)_/ {print "-e " $$1}')
|
||||
BB_RPC_ENV := $(shell env | awk -F= '/^BB_RPC_(URL_HTTP|URL_WS|BIND_HOST|ALLOW_IP)_/ {print "-e " $$1}')
|
||||
|
||||
TARGETS=$(subst .json,, $(shell ls configs/coins))
|
||||
|
||||
|
||||
@@ -193,7 +193,7 @@ func readCoinAlias(path string) (string, error) {
|
||||
}
|
||||
|
||||
func rpcEnvPrefixes() []string {
|
||||
return []string{"BB_RPC_URL_WS_", "BB_RPC_URL_", "BB_RPC_BIND_HOST_", "BB_RPC_ALLOW_IP_"}
|
||||
return []string{"BB_RPC_URL_WS_", "BB_RPC_URL_HTTP_", "BB_RPC_BIND_HOST_", "BB_RPC_ALLOW_IP_"}
|
||||
}
|
||||
|
||||
func collectUnknownRPCEnvVars(validAliases map[string]struct{}, prefixes []string) []string {
|
||||
@@ -299,7 +299,7 @@ func LoadConfig(configsDir, coin string) (*Config, error) {
|
||||
config.Env.RPCAllowIP = allowIP
|
||||
}
|
||||
|
||||
rpcURLKey := "BB_RPC_URL_" + config.Coin.Alias // Use alias so env naming matches coin config and deployment conventions.
|
||||
rpcURLKey := "BB_RPC_URL_HTTP_" + config.Coin.Alias // Use alias so env naming matches coin config and deployment conventions.
|
||||
if rpcURL, ok := os.LookupEnv(rpcURLKey); ok && rpcURL != "" {
|
||||
// Prefer explicit env override so package generation/tests can target hosted RPC endpoints without editing JSON.
|
||||
config.IPC.RPCURLTemplate = rpcURL
|
||||
|
||||
@@ -88,15 +88,15 @@ command: `make NO_CACHE=true all-bitcoin`.
|
||||
|
||||
`PORTABLE`: By default, the RocksDB binaries shipped with Blockbook are optimized for the platform you're compiling on (-march=native or the equivalent). If you want to build a portable binary, use `make PORTABLE=1 all-bitcoin`.
|
||||
|
||||
`BB_RPC_URL_<coin alias>`: Overrides `ipc.rpc_url_template` while generating package definitions so you can target
|
||||
hosted HTTP RPC endpoints without editing coin JSON. The root `Makefile` forwards any `BB_RPC_URL_*` variables into the
|
||||
`BB_RPC_URL_HTTP_<coin alias>`: Overrides `ipc.rpc_url_template` while generating package definitions so you can target
|
||||
hosted HTTP RPC endpoints without editing coin JSON. The root `Makefile` forwards any `BB_RPC_URL_HTTP_*` variables into the
|
||||
Docker build/test containers.
|
||||
|
||||
`BB_RPC_URL_WS_<coin alias>`: Overrides `ipc.rpc_url_ws_template` for WebSocket subscriptions. It should point to the
|
||||
same host as `BB_RPC_URL_<coin alias>`.
|
||||
same host as `BB_RPC_URL_HTTP_<coin alias>`.
|
||||
|
||||
Example:
|
||||
`BB_RPC_URL_ethereum=http://backend_hostname:1234 BB_RPC_URL_WS_ethereum_archive=ws://backend_hostname:1234 make deb-ethereum_archive`.
|
||||
`BB_RPC_URL_HTTP_ethereum=http://backend_hostname:1234 BB_RPC_URL_WS_ethereum_archive=ws://backend_hostname:1234 make deb-ethereum_archive`.
|
||||
|
||||
`BB_RPC_BIND_HOST_<coin alias>`: Overrides backend RPC bind host during package generation. Defaults to `127.0.0.1`
|
||||
to avoid unintended exposure. Example: `BB_RPC_BIND_HOST_ethereum=0.0.0.0 make deb-ethereum`.
|
||||
|
||||
@@ -36,8 +36,8 @@ Good examples of coin configuration are
|
||||
|
||||
* `ipc` – Defines how Blockbook connects its back-end service.
|
||||
* `rpc_url_template` – Template that defines URL of back-end RPC service. See note on templates below. You can
|
||||
override it at build time by setting `BB_RPC_URL_<coin alias>` (for example,
|
||||
`BB_RPC_URL_ethereum=http://backend_hostname:1234`), which is used as-is during template generation.
|
||||
override it at build time by setting `BB_RPC_URL_HTTP_<coin alias>` (for example,
|
||||
`BB_RPC_URL_HTTP_ethereum=http://backend_hostname:1234`), which is used as-is during template generation.
|
||||
* `rpc_url_ws_template` – Template that defines URL of back-end WebSocket RPC service for subscriptions. You can
|
||||
override it at build time by setting `BB_RPC_URL_WS_<coin alias>` and it should point to the same host as
|
||||
`rpc_url_template`.
|
||||
|
||||
@@ -12,10 +12,10 @@ Some behavior of Blockbook can be modified by environment variables. The variabl
|
||||
|
||||
## Build-time variables
|
||||
|
||||
- `BB_RPC_URL_<coin alias>` - Overrides `ipc.rpc_url_template` during package/config generation so build and
|
||||
- `BB_RPC_URL_HTTP_<coin alias>` - Overrides `ipc.rpc_url_template` during package/config generation so build and
|
||||
integration-test tooling can target hosted HTTP RPC endpoints without editing coin JSON.
|
||||
- `BB_RPC_URL_WS_<coin alias>` - Overrides `ipc.rpc_url_ws_template` for WebSocket subscriptions; should point to
|
||||
the same host as `BB_RPC_URL_<coin alias>`.
|
||||
the same host as `BB_RPC_URL_HTTP_<coin alias>`.
|
||||
- `BB_RPC_BIND_HOST_<coin alias>` - Overrides backend RPC bind host during package/config generation; when set to
|
||||
`0.0.0.0`, RPC stays restricted unless `BB_RPC_ALLOW_IP_<coin alias>` is set.
|
||||
- `BB_RPC_ALLOW_IP_<coin alias>` - Overrides backend RPC allow list for UTXO configs (e.g. `rpcallowip`), defaulting
|
||||
|
||||
@@ -55,7 +55,7 @@ For simplicity, URLs and credentials of back-end services, where are tests going
|
||||
from *blockbook/configs/coins*, the same place from where are production configuration files generated. There are general
|
||||
URLs that link to *localhost*. If you need run tests against remote servers, there are few options how to do it:
|
||||
|
||||
* set `BB_RPC_URL_<coin alias>` to override `rpc_url_template` during template generation (forwarded into Docker by the root `Makefile`)
|
||||
* set `BB_RPC_URL_HTTP_<coin alias>` to override `rpc_url_template` during template generation (forwarded into Docker by the root `Makefile`)
|
||||
* set `BB_RPC_URL_WS_<coin alias>` to override `rpc_url_ws_template` for WebSocket subscriptions when needed
|
||||
* temporarily change config
|
||||
* SSH tunneling – `ssh -nNT -L 8030:localhost:8030 remote-server`
|
||||
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
func TestLoadBlockchainCfgEnvOverride(t *testing.T) {
|
||||
const wantHTTP = "http://backend_hostname:1234"
|
||||
const wantWS = "ws://backend_hostname:1234"
|
||||
t.Setenv("BB_RPC_URL_ethereum", wantHTTP)
|
||||
t.Setenv("BB_RPC_URL_HTTP_ethereum", wantHTTP)
|
||||
t.Setenv("BB_RPC_URL_WS_ethereum", wantWS)
|
||||
|
||||
cfg := bchain.LoadBlockchainCfg(t, "ethereum")
|
||||
|
||||
Reference in New Issue
Block a user