Skip to content

Commit

Permalink
🔧 add the configuration for HTTP v1
Browse files Browse the repository at this point in the history
The configuration that needs to be specified for v1 calls is different from the
legacy FCM API
https://github.com/olucurious/PyFCM?tab=readme-ov-file#updates-breaking-changes

We now need to specify the path to the service account JSON file, and the
project_id. Adding these to the config file temporarily so that we can test it
on staging more easily. Once they are known to work, we can put them into the
list of environment variables for the cloud services team to configure.
  • Loading branch information
shankari committed Sep 12, 2024
1 parent a802747 commit 666a8f5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion conf/net/ext_service/push.json.sample
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@
"provider": "firebase",
"server_auth_token": "Get from firebase console",
"app_package_name": "full package name from config.xml. e.g. edu.berkeley.eecs.emission or edu.berkeley.eecs.embase. Defaults to edu.berkeley.eecs.embase",
"ios_token_format": "fcm"
"ios_token_format": "fcm",
"project_id": "Get from the General project settings (https://console.cloud.google.com/project/_/settings/general/) tab of the Firebase console.",
"service_account_file": "Download according to the instructions at https://firebase.google.com/docs/cloud-messaging/migrate-v1#provide-credentials-manually and put the path to the file here"
}
3 changes: 2 additions & 1 deletion emission/net/ext_service/push/notify_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@

push_config = ecbc.get_config('conf/net/ext_service/push.json',
{"PUSH_PROVIDER": "provider", "PUSH_SERVER_AUTH_TOKEN": "server_auth_token",
"PUSH_APP_PACKAGE_NAME": "app_package_name", "PUSH_IOS_TOKEN_FORMAT": "ios_token_format"})
"PUSH_APP_PACKAGE_NAME": "app_package_name", "PUSH_IOS_TOKEN_FORMAT": "ios_token_format",
"PUSH_PROJECT_ID": "project_id", "PUSH_SERVICE_ACCOUNT_FILE": "service_account_file"})

try:
logging.warning(f"Push configured for app {push_config.get('PUSH_APP_PACKAGE_NAME')} using platform {push_config.get('PUSH_PROVIDER')} with token {push_config.get('PUSH_SERVER_AUTH_TOKEN')[:10]}... of length {len(push_config.get('PUSH_SERVER_AUTH_TOKEN'))}")
Expand Down

0 comments on commit 666a8f5

Please sign in to comment.