Closed arbazkiraak closed 1 year ago
hey @arbazkiraak appreciate the PR! the env var being used (JSON_RPC_HOST) is the one used by the scan node in production to inject its own RPC URL. for local development, you should just set jsonRpcUrl
in forta.config.json file. if this does not meet your requirements, please let me know the specific scenario
Currently:
The way forta loads up the RPC endpoint is either via ENV or jsonRpcUrl
in forta.config.json file
def get_json_rpc_url():
if 'JSON_RPC_HOST' in os.environ:
return f'https://{os.environ["JSON_RPC_HOST"]}{":"+os.environ["JSON_RPC_PORT"] if "JSON_RPC_PORT" in os.environ else ""}'
Reproduce the following:
jsonRpcUrl
in forta.config.json file and run the node by following command.JSON_RPC_HOST=https://arb-mainnet.g.alchemy.com/v2/<KEY> npm start
The Node by default with listen to the "https://cloudflare-eth.com/
because of the following condition
https://github.com/forta-network/forta-bot-sdk/blob/master/cli/di.container.ts#L248
to switch between multiple chains in the same project, the recommended way is to use the --config
flag to select a different json config file (default is forta.config.json). see the CLI reference here: https://docs.forta.network/en/latest/cli/#run
There is a bug while reading up the environment variable for JSON RPC. The current implementation just checks the URL from
forta.config.json
but this adds the ability to load from the ENV variable.Currently, all the environment HOST variables are defaulted to
http://
, Can we moved them tohttps://
or just fully expect the jsonRPCUrl environment value instead of appendinghttps://