Skip to content

Conversation

@klkvr
Copy link
Member

@klkvr klkvr commented Jun 29, 2023

Motivation

RIght now, chisel ignores dotenv files (at least on startup), and this leads to it being unable to fork chain which RPC_URL is set in config via .env variable.

For example:

foundry.toml:

[profile.default]
src = "src"
out = "out"
libs = ["lib"]

[rpc_endpoints]
goerli = "${GOERLI_RPC}"
.env:

GOERLI_RPC=some_rpc

In such context chisel --fork-url goerli will fail with following error Failed to resolve env var GOERLI_RPC in ${GOERLI_RPC}: environment variable not found until the GOERLI_URL will not be explicitely set to environment via export GOERLI_RPC=some_rpc

Solution

Add utils::load_dotenv to startup of chisel

Copy link
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reasonable, lgtm

@mattsse mattsse added the C-chisel Command: chisel label Jun 29, 2023
Copy link
Member

@Evalir Evalir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice! lgtm—tested and seems correct

@Evalir Evalir merged commit 0396e22 into foundry-rs:master Jun 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-chisel Command: chisel

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants