Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Change the way in which we read the configuration variables #979

Merged
merged 1 commit into from
Sep 12, 2024

Conversation

shankari
Copy link
Contributor

The changes made to support the new configuration methodology failed with this error

ERROR:root:name 'os' is not defined
Traceback (most recent call last):
  File "/usr/src/app/emission/net/ext_service/push/notify_interface.py", line 27, in <module>
    logging.warning(f"Push configured for app {push_config.get('PUSH_APP_PACKAGE_NAME')} using platform {os.getenv('PUSH_PROVIDER')} with token {os.getenv('PUSH_SERVER_AUTH_TOKEN')[:10]}... of length {len(os.getenv('PUSH_SERVER_AUTH_TOKEN'))}")
NameError: name 'os' is not defined

The fix is simply to use push_config.get instead of os.getenv. Also logged the full exception instead of simply generating a warning that the functionality is not supported.

Testing done:

  • Before: error above
  • After:
Found configuration, overriding...
Activating the environment...
Run trip labeling reminder...
WARNING:root:About to read push configuration...
WARNING:root:Push configured for app gov.nrel.cims.openpath using platform firebase with token ... of length 152

The changes made to support the new configuration methodology failed with this error

```
ERROR:root:name 'os' is not defined
Traceback (most recent call last):
  File "/usr/src/app/emission/net/ext_service/push/notify_interface.py", line 27, in <module>
    logging.warning(f"Push configured for app {push_config.get('PUSH_APP_PACKAGE_NAME')} using platform {os.getenv('PUSH_PROVIDER')} with token {os.getenv('PUSH_SERVER_AUTH_TOKEN')[:10]}... of length {len(os.getenv('PUSH_SERVER_AUTH_TOKEN'))}")
NameError: name 'os' is not defined
```

The fix is simply to use `push_config.get` instead of `os.getenv`. Also logged
the full exception instead of simply generating a warning that the functionality is not supported.

Testing done:
- Before: error above
- After:

```
Found configuration, overriding...
Activating the environment...
Run trip labeling reminder...
WARNING:root:About to read push configuration...
WARNING:root:Push configured for app gov.nrel.cims.openpath using platform firebase with token ... of length 152
```
@shankari shankari merged commit de250e7 into e-mission:master Sep 12, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant