Open karalabe opened 1 year ago
My hesitation about env vars is that they get silently ignored if you typo the variable name. It's probably something we could still have a go at though. Our track record with making sweeping changes to the CLI arg parsing is... not good however. We're on an old arg-parsing library at the moment, and previous attempts to add config file support bit-rotted and never merged (cf. #2748).
True, that mistyping could have adverse effects. Wondering how I'd solve it (for us too), perhaps one way would be to iterate over all the GETH_
prefixed env vars on startup, and anything not mapped to a flag would be printed in a warning log saying that an env var is present, but not used. Of course, it's still not as strict as flat out refusing to start on a bad flag, but it's a step closer to finding issues.
A quick implementation:
Is this feature still being considered? This would make docker setups less painful to configure.
It’s been merged and released months ago :)
On Sun, 21 Jan 2024 at 17:32, protolambda @.***> wrote:
Is this feature still being considered? This would make docker setups less painful to configure.
— Reply to this email directly, view it on GitHub https://github.com/sigp/lighthouse/issues/4734#issuecomment-1902688183, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAA7UGLJCBVLJYN5S5DINFDYPU7K7AVCNFSM6AAAAAA4X7QH5KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMBSGY4DQMJYGM . You are receiving this because you authored the thread.Message ID: @.***>
Oh shit, wrong repo, sorry for the noise
On Sun, 21 Jan 2024 at 19:35, Péter Szilágyi @.***> wrote:
It’s been merged and released months ago :)
On Sun, 21 Jan 2024 at 17:32, protolambda @.***> wrote:
Is this feature still being considered? This would make docker setups less painful to configure.
— Reply to this email directly, view it on GitHub https://github.com/sigp/lighthouse/issues/4734#issuecomment-1902688183, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAA7UGLJCBVLJYN5S5DINFDYPU7K7AVCNFSM6AAAAAA4X7QH5KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMBSGY4DQMJYGM . You are receiving this because you authored the thread.Message ID: @.***>
Linking related latest issue to overhaul the CLI
Any chance this feature can be implemented, now that the mainnet Dencun release is out of the way? I am still interested in being able to configure lighthouse this way.
We've just introduced a nifty feature into Geth where you can specify configurations in env vars too, not only cli flags. Each flag is mapped to an env var automatically, so it's fairly obvious and easy to understand.
E.g.
--state.scheme
would beGETH_STATE_SCHEME
Wondering if Lighthouse has a similar feature planned?
The benefit of this is that in many cloud or container provider settings, the usual way to configure stuff is via env vars. Most providers allow you to define env vars in templates, add defaults, docs, etc to them, making these templates easy to redistribute and even check for issues. Although they usually also support passing CLI flags, that's just one mega-mess of a single string containing everything, so it's very brittle.
My assumption is that whatever CLI library you're using already has support for env vars, you just need to tell them which var is mapped to which flag.