spec icon indicating copy to clipboard operation
spec copied to clipboard

RFC: Loading parameters from environment variables

Open kba opened this issue 5 years ago • 0 comments

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/model
  • OCRD_SBB_BINARIZE_PARAM_MODEL=/path/to/model ocrd-sbb-binarize

kba avatar Oct 22 '20 15:10 kba