-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Route notifications to FCM (Android) (#171)
* Move RouterType to extractors/routers.rs * Remove GCM as a router type Google Cloud Messaging has been deprecated in favor of FCM, and as of May 29, 2019 it no longer functions. * Add FCM router stub * Remove some unnecessary FCM settings * Implement insert_opt on HashMap for more concise code Also renamed the Content-Encoding header field to "encoding", which is what the rest of autopush/webpush expects. * Implement (most of) FcmRouter * Implement FcmClient * Differentiate between a connection error and a timeout in FcmClient * Log and increment metrics in FcmRouter when a FcmClient error occurs * Add RouterResponse::success to avoid code duplication between routers * Clarify how long MAX_TTL is * Move the base FCM url to settings This will make testing easier, for example with mockito. * Error if unknown settings are provided * Add tests to FcmClient * Add .gitguardian.yml * Add some logging to FcmRouter * Fix returning an invalid URL after routing a notification * Add tests to FcmRouter * Make router_data optional This fixes the integration tests, because sometimes users would not have any router data in DynamoDB. Also, just to be safe, router_data uses rusoto's AttributeValue instead of serde_json::Value. * Switch router_data back to serde_json::Value This allows us to use DynamoDbUser with any version of rusoto. * Make FCM request timeout a config option * Use a more obvious UUID when testing Closes #162
- Loading branch information
1 parent
2d4d08f
commit d9a0d9d
Showing
21 changed files
with
1,377 additions
and
242 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
paths-ignore: | ||
# This is a fake key to make the OAuth client happy. | ||
- "autoendpoint/src/server/routers/fcm/client.rs" |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# Operation Notes / Runbook (WIP) | ||
- Logging level can be controlled via the `RUST_LOG` env variable on a per-module | ||
basis: https://docs.rs/slog-envlogger/2.2.0/slog_envlogger/ | ||
basis: https://docs.rs/slog-envlogger/2.2.0/slog_envlogger/ | ||
- Nested settings (ex. `FcmSettings`) can be set with environment variables. For | ||
example, to set `settings.fcm.ttl`, use `AUTOEND_FCM.TTL=60` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.