Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuration from file #458

Open
rakita opened this issue Jul 4, 2022 · 6 comments
Open

Configuration from file #458

rakita opened this issue Jul 4, 2022 · 6 comments
Labels

Comments

@rakita
Copy link
Contributor

rakita commented Jul 4, 2022

In most cases you would like to specify some cli argument in the config file so that you don't have to use it every time when running fuel-core and can just specify the config file you want to run fuel-core run --config=local.toml

I don't think it is supported in clap and we need to use additional structure and lib to parse configuration from toml into fuel-core

@ControlCplusControlV
Copy link
Contributor

ControlCplusControlV commented Jul 5, 2022

This would be a huge UX improvement rather than pasting 100 lines of json into a command. Is there a reason the config file would be .toml over .json/.yaml other than homogeneity with Rust's Cargo.toml? Right now chain_config is exported via json, so would the config have json values within a toml file?

@rakita
Copy link
Contributor Author

rakita commented Jul 6, 2022

there is a good amount of discussion about toml vs yaml where it is said that toml is better for simple configurations. And having it used by rust cargo is good alignment for us.
having .json as config is considered unredable and it is used mostly as it is easy to serialize/unserialize data. We can probably have a field in the config that points to chain_config json file (renaming it to chainspec.json feels better) as it will contain data for the initialization of the chain. This is something that is not expected to change when setting the genesis block so it seems okay to put that data in json.

@Voxelot
Copy link
Member

Voxelot commented Jul 8, 2022

We should still support CLI args as well, since they are easier to templatize and configure in helm charts.

Toml based config files would align with other parts of our eco-system such as Forc.toml. However, there's likely parsers out there that are file-format agnostic since you can generally represent the same kinds of underlying structures (i.e. nested hashmaps) using json, yaml or toml.

@MitchTurner
Copy link
Member

We now have the option of including an env file to specify many of the values you would pass to the cli. However, not all arguments can be read/overridden with the env variables.

If we added support for all the arguments, that would resolve this issue.

@MitchTurner MitchTurner added the good first issue Good for newcomers label May 30, 2024
@thedevbirb
Copy link

Hi @MitchTurner, I'd love to start contributing to Fuel. Can I take this issue?
By the way, what is an example of argument that cannot be read/overridden by the env file?

Thanks!

@MitchTurner
Copy link
Member

@thedevbirb Hey! Welcome! We are always open to contributions from the community. Feel free to work on this and let us know if you have questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants