Skip to content

Commit

Permalink
♻️ Access the environment variables from the config using .get
Browse files Browse the repository at this point in the history
So that we can get a full list of the environment variable by grepping
properly

```
$ grep -r 'config.get("[A-Z]' emission/
emission//net/ext_service/push/notify_interface_impl/firebase.py:        self.server_auth_token = push_config.get("PUSH_SERVER_AUTH_TOKEN")
emission//net/ext_service/push/notify_interface_impl/firebase.py:            self.app_package_name = push_config.get("PUSH_APP_PACKAGE_NAME")
emission//net/ext_service/push/notify_interface_impl/firebase.py:        self.is_fcm_format = push_config.get("PUSH_IOS_TOKEN_FORMAT") == "fcm"
emission//net/ext_service/push/notify_interface.py:        return NotifyInterfaceFactory.getNotifyInterface(push_config.get("PUSH_PROVIDER"))
emission//net/api/cfc_webapp.py:server_port = config.get("WEBSERVER_PORT", 8080)
emission//net/api/cfc_webapp.py:socket_timeout = config.get("WEBSERVER_TIMEOUT", 3600)
emission//net/api/cfc_webapp.py:auth_method = config.get("WEBSERVER_AUTH", "skip")
emission//net/api/cfc_webapp.py:aggregate_call_auth = config.get("WEBSERVER_AGGREGATE_CALL_AUTH", "no_auth")
emission//net/api/cfc_webapp.py:not_found_redirect = config.get("WEBSERVER_NOT_FOUND_REDIRECT", "https://nrel.gov/openpath")
emission//core/get_database.py:url = config.get("DB_HOST", "localhost")
emission//core/get_database.py:result_limit = config.get("DB_RESULT_LIMIT", 250000)
```
  • Loading branch information
shankari committed Aug 12, 2024
1 parent 357d4b8 commit b6f59b0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion emission/net/ext_service/push/notify_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
class NotifyInterfaceFactory(object):
@staticmethod
def getDefaultNotifyInterface():
return NotifyInterfaceFactory.getNotifyInterface(push_config["PUSH_PROVIDER"])
return NotifyInterfaceFactory.getNotifyInterface(push_config.get("PUSH_PROVIDER"))

@staticmethod
def getNotifyInterface(pushProvider):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ def get_interface(push_config):

class FirebasePush(pni.NotifyInterface):
def __init__(self, push_config):
self.server_auth_token = push_config["PUSH_SERVER_AUTH_TOKEN"]
self.server_auth_token = push_config.get("PUSH_SERVER_AUTH_TOKEN")
if "PUSH_APP_PACKAGE_NAME" in push_config:
self.app_package_name = push_config["PUSH_APP_PACKAGE_NAME"]
self.app_package_name = push_config.get("PUSH_APP_PACKAGE_NAME")
else:
logging.warning("No package name specified, defaulting to embase")
self.app_package_name = "edu.berkeley.eecs.embase"
self.is_fcm_format = push_config["PUSH_IOS_TOKEN_FORMAT"] == "fcm"
self.is_fcm_format = push_config.get("PUSH_IOS_TOKEN_FORMAT") == "fcm"

def get_and_invalidate_entries(self):
# Need to figure out how to do this on firebase
Expand Down

0 comments on commit b6f59b0

Please sign in to comment.