postcards icon indicating copy to clipboard operation
postcards copied to clipboard

Config: Separate recipient from config

Open matbech opened this issue 8 years ago • 2 comments

My use case is one post account with multiple recipients. Hence, it would be nice if the recipient config could be separated from the account/sender config file. Possibly, in a "address book" like config file. --account "account.conf" --recipient "recipient.conf" This way I don't have to duplicate the account/sender information in every config file.

matbech avatar Nov 19 '17 23:11 matbech

Please be aware that the terminology for account is a https://postcardcreator.post.ch/ account, whereas sender is the sender of the postcard.

Instead of 2 new flags, we should add a single one to overwrite/ set the recipient of the postcard. One can send postcards to multiple recipients by issuing postcards with different --recipient-files

The following steps are a sound approach to me:

  • add a single new flag --recipient-file to link to a json file which contains the recipient object
  • the recipient can be overwritten with --recipient-file: if the recipient is specified in --config <file>, the recipient set via --recipient-file is used.
  • Validation of --config needs to permit no recipient if a recipient is set via --recipient-file

I flagged this as a feature so we can cover it the next major release.

If your usecases require more sophisticated, "address book" like functionality, i suggest you use the Rest API wrapper directly https://github.com/abertschi/postcard_creator_wrapper.

abertschi avatar Nov 20 '17 10:11 abertschi

Until then, you could create a small script that generates aconfig.json on the fly by including recipients from different files based on input flags.

abertschi avatar Nov 20 '17 10:11 abertschi