Page MenuHomePhabricator

[reports-service] Parse email config from CLI args
ClosedPublic

Authored by bartek on Aug 28 2023, 6:35 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Oct 28, 6:45 PM
Unknown Object (File)
Sun, Oct 27, 4:50 PM
Unknown Object (File)
Sun, Oct 27, 4:46 PM
Unknown Object (File)
Wed, Oct 23, 3:39 AM
Unknown Object (File)
Wed, Oct 23, 1:34 AM
Unknown Object (File)
Sun, Oct 20, 12:17 AM
Unknown Object (File)
Sun, Oct 20, 12:10 AM
Unknown Object (File)
Sat, Oct 19, 11:31 PM
Subscribers

Details

Summary

Introduced possibility to pass email config either via CLI args, or from a file (with path configurable from CLI).
The Postmark API token can also be passed as an env variable.

Config being None means that e-mails are disabled.

Depends on D8978

Test Plan

Unit tests, also printed the config object and confirmed that:

  • Config is None if no args passed and no email-config.json present
  • Config is Some if no args passed and valid email-config.json present
  • Config is None if no args passed and invalid email-config.json present
  • Config from email-config.json is overriden by inline json passed as --email-config arg
  • Error is raised if --email-config arg contains invalid JSON (malfolmed or missing fields)
  • Error is raised if both --email-config and --email-config-file are present at the same time
  • Error is raised if --email-config-file contains invalid path (e.g. file not exists)
  • Error is raised if --email-config-file contains path to incorrect JSON
  • Postmark token is read from the config file
  • If POSTMARK_TOKEN env is present, it overrides the file value
  • If the token isn't present in the config file or env, an warn is displayed and config is None

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable