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)
Tue, May 7, 2:24 AM
Unknown Object (File)
Sat, Apr 27, 8:54 AM
Unknown Object (File)
Apr 15 2024, 3:35 AM
Unknown Object (File)
Apr 13 2024, 3:35 AM
Unknown Object (File)
Apr 10 2024, 12:47 PM
Unknown Object (File)
Apr 8 2024, 2:40 AM
Unknown Object (File)
Apr 5 2024, 11:09 PM
Unknown Object (File)
Apr 5 2024, 10:51 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