diff --git a/Makefile b/Makefile index 6ebb54a8..291bb8e3 100644 --- a/Makefile +++ b/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)) diff --git a/build/tools/templates.go b/build/tools/templates.go index fd36d3c1..ee4c2f1a 100644 --- a/build/tools/templates.go +++ b/build/tools/templates.go @@ -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 diff --git a/docs/build.md b/docs/build.md index 192fed86..f74a9419 100644 --- a/docs/build.md +++ b/docs/build.md @@ -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_`: 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_`: 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_`: Overrides `ipc.rpc_url_ws_template` for WebSocket subscriptions. It should point to the -same host as `BB_RPC_URL_`. +same host as `BB_RPC_URL_HTTP_`. 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_`: 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`. diff --git a/docs/config.md b/docs/config.md index e43f1f83..d004d936 100644 --- a/docs/config.md +++ b/docs/config.md @@ -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_` (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_` (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_` and it should point to the same host as `rpc_url_template`. diff --git a/docs/env.md b/docs/env.md index e881671e..da924ba3 100644 --- a/docs/env.md +++ b/docs/env.md @@ -12,10 +12,10 @@ Some behavior of Blockbook can be modified by environment variables. The variabl ## Build-time variables -- `BB_RPC_URL_` - Overrides `ipc.rpc_url_template` during package/config generation so build and +- `BB_RPC_URL_HTTP_` - 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_` - Overrides `ipc.rpc_url_ws_template` for WebSocket subscriptions; should point to - the same host as `BB_RPC_URL_`. + the same host as `BB_RPC_URL_HTTP_`. - `BB_RPC_BIND_HOST_` - Overrides backend RPC bind host during package/config generation; when set to `0.0.0.0`, RPC stays restricted unless `BB_RPC_ALLOW_IP_` is set. - `BB_RPC_ALLOW_IP_` - Overrides backend RPC allow list for UTXO configs (e.g. `rpcallowip`), defaulting diff --git a/docs/testing.md b/docs/testing.md index bb48a8a3..fe2bb5d0 100644 --- a/docs/testing.md +++ b/docs/testing.md @@ -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_` to override `rpc_url_template` during template generation (forwarded into Docker by the root `Makefile`) +* set `BB_RPC_URL_HTTP_` to override `rpc_url_template` during template generation (forwarded into Docker by the root `Makefile`) * set `BB_RPC_URL_WS_` to override `rpc_url_ws_template` for WebSocket subscriptions when needed * temporarily change config * SSH tunneling – `ssh -nNT -L 8030:localhost:8030 remote-server` diff --git a/tests/config_loader_test.go b/tests/config_loader_test.go index 2db080c9..310984bb 100644 --- a/tests/config_loader_test.go +++ b/tests/config_loader_test.go @@ -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")