anoma / namada

Rust implementation of Namada, a Proof-of-Stake L1 for interchain asset-agnostic privacy
https://namada.net
GNU General Public License v3.0
2.4k stars 956 forks source link

Overriding `config.toml` values via the environment doesn't use prefix separator #399

Closed james-chf closed 3 months ago

james-chf commented 2 years ago

We should be able to override .anoma/<chain-id>/config.toml values by specifying envvars at runtime prefixed with ANOMA__. e.g. ANOMA__WASM_DIR to set the wasm_dir value, or ANOMA__LEDGER__SHELL__DB_DIR to set the ledger.shell.db_dir value.

In Namada v0.7.1, due to an issue with the version of the underlying config crate we are using, we need to prefix with ANOMA_ rather than ANOMA__ (https://github.com/mehcode/config-rs/issues/173). If we upgrade our config crate, the behaviour will change to prefixing with ANOMA__, so if/when we upgrade we should update usages or otherwise upgrade in such a way that we can keep using ANOMA_ as a prefix. We should also document how we override configuration somewhere.

james-chf commented 2 years ago

I've updated this issue cc @Fraccaman , maybe we want to keep the current ANOMA_ prefix. I've marked this as lower priority now since there is a way to override config via the environment.

james-chf commented 2 years ago

Unassigning myself for the time being as will not be working on this, although https://github.com/anoma/namada/pull/398 does update the crate, it will probably break a lot of places where we are using ANOMA_ environment variables