cculianu / Fulcrum

A fast & nimble SPV Server for BCH, BTC, and LTC
Other
331 stars 76 forks source link

Feature: All configuration options as environment variables or CLI arguments #154

Closed dorveille closed 1 year ago

dorveille commented 1 year ago

Having all configuration options available as environment variables or CLI arguments would make it easier to deploy the cculianu/fulcrum docker image in to production.

There are well documented configuration options which are only available by specifying a configuration file. To use these requires maintaining a separate configuration file, as well as it requires having access to the filesystem before launching the container, which is not always possible or easy in cloud environments. A workaround might be to create a custom image based off cculianu/fulcrum and include a fulcrum.conf, but then this does not permit unique configuration values per environment.

Adding this support would make Fulcrum a first class citizen in the world of docker.

cculianu commented 1 year ago

Not a bad idea.

Hmm. Maybe a CLI arg can be used to specify that the "conf file" should come from the environment...?

cculianu commented 1 year ago

What about specifying the "conf" file as /proc/self/environ (linux only). I can make it so the conf file parser knows how to read this file such that it translates the embedded 0x0 chars into -> NL

cculianu commented 1 year ago

Ok, this has been added. You can specify _ENV_ as the config file name and it will read the environment instead (/proc/self/environ will also work after this commit, on Linux only). This will appear in the next release of Fulcrum which I hope to get out soon (maybe this week).

Thanks for the suggestion! It was an easy and useful one!

dorveille commented 1 year ago

This is great, thanks for this! I'll test it out.