Page MenuHomePhabricator

[Tunnelbroker] implement APNs config
ClosedPublic

Authored by kamil on Jun 28 2024, 4:25 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Oct 14, 8:36 AM
Unknown Object (File)
Mon, Oct 14, 7:12 AM
Unknown Object (File)
Mon, Oct 14, 2:43 AM
Unknown Object (File)
Fri, Oct 11, 12:52 AM
Unknown Object (File)
Fri, Oct 11, 12:52 AM
Unknown Object (File)
Fri, Oct 11, 12:52 AM
Unknown Object (File)
Fri, Oct 11, 12:51 AM
Unknown Object (File)
Fri, Oct 11, 12:51 AM
Subscribers

Details

Summary

Config to APNs similar to keyserver, but instead of reading private key from the file we pass it inside JSON (command line or AWS KMS secrets).

Keyserver config: link.

Depends on D12608

Test Plan
  1. Add config var from commandline and log it
  2. For staging (using env::var) going to test after deploying

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

kamil held this revision as a draft.
kamil published this revision for review.Jun 28 2024, 6:24 AM
kamil edited the summary of this revision. (Show Details)
bartek requested changes to this revision.Jul 1 2024, 1:58 AM

Can we either?:

  • Fully rely on clap parsing the env variable
  • Remove the env support in clap
services/tunnelbroker/src/config.rs
31 ↗(On Diff #41786)
  1. This code means you can pass either --apns-config CLI param or env variable named "ENV_APNS_CONFIG".
  2. Separately you have crate::constants::ENV_APNS_CONFIG (which has value "APNS_CONFIG") and you're parsing it below (manually without clap).

If you go with 2 only, you can remove this line

services/tunnelbroker/src/main.rs
36–42 ↗(On Diff #41786)

If you rely on clap parsing the env var, this shouldn't be necessary, #[arg(env = ENV_APNS_CONFIG)] should handle it for you

This revision now requires changes to proceed.Jul 1 2024, 1:59 AM

Thanks, @bartek, update to rely on clap.

Tested both:

cargo run -- --apns-config '{"key":"your_key_here","keyId":"your_key_id_here","teamId":"your_team_id_here","production":true}'

and

APNS_CONFIG='{"key":"your_key_here","keyId":"your_key_id_here","teamId":"your_team_id_here","production":true}' cargo run

I'm glad it worked, thanks!

This revision is now accepted and ready to land.Jul 2 2024, 3:36 AM
This revision was automatically updated to reflect the committed changes.