0xSpaceShard / starknet-devnet-rs

A local testnet for Starknet... in Rust
https://0xspaceshard.github.io/starknet-devnet-rs/
MIT License
104 stars 60 forks source link

Feature request: Add CLI option that loads devnet config from JSON file. #475

Closed 3alpha closed 3 months ago

3alpha commented 3 months ago

Passing complicated configuration settings using CLI flags can become impractical, and since there is already /configendpoint that dumps configuration into JSON, it only would only make sense to have CLI flag that can read file of that format to spin up devnet instance with same configuration.

FabijanC commented 3 months ago

If we support specifying CLI params via env vars, as proposed in #482, this issue might not require a lot (or any) work. The user could simply source the env file (file with env vars), or specify the path to the env file, perhaps via a dedicated env var.

E.g. assuming the user has an env file at ./env_vars:

export ACCOUNTS=3
export SEED=42

One of the following could be supported:

Using source

Relying on source wouldn't require doing any work to close this issue.

source ./env_vars && starknet-devnet

Alternatively, run in a subshell to prevent keeping the env vars set:

( source ./env_vars && starknet-devnet )

Using an env var

Using a DEVNET_ENV env var would be simpler for the user, but would require adding some code logic, just as would adding an --env-file CLI parameter.

DEVNET_ENV=./env_vars starknet-devnet