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, Nov 25, 6:40 AM
Unknown Object (File)
Mon, Nov 25, 4:33 AM
Unknown Object (File)
Mon, Nov 25, 4:29 AM
Unknown Object (File)
Mon, Nov 25, 2:28 AM
Unknown Object (File)
Oct 28 2024, 6:45 PM
Unknown Object (File)
Oct 27 2024, 4:50 PM
Unknown Object (File)
Oct 27 2024, 4:46 PM
Unknown Object (File)
Oct 23 2024, 3:39 AM
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