spec
spec copied to clipboard
RFC: Loading parameters from environment variables
Since this has been requested a few times, here's a proposal how this could work:
In addition to explicit -p/-P CLI options, also look up environment variables that - in uppercase and with dashes replaced by underscore - have the syntax <processor-name>_PARAM_<parameter-name>. The value should be parsed with the same conventions as for -P, i.e. first trying to parse as JSON and use as string literal if that fails.
For example, there would now be three possibilities to specify the model parameter for sbb_binarization:
ocrd-sbb-binarize -p '{"model": "/path/to/model"}'ocrd-sbb-binarize -P model /path/to/modelOCRD_SBB_BINARIZE_PARAM_MODEL=/path/to/model ocrd-sbb-binarize