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

Use api key helper during app creation. #4969

Merged
merged 9 commits into from
Feb 21, 2025

Conversation

clincoln8
Copy link
Contributor

@clincoln8 clincoln8 commented Feb 20, 2025

Migrate each instance of fetching api keys to use a single helper function.
Add a check to ensure that DC_API_KEY was provided as an environment variable when running in LITE mode.

Copy link
Contributor

@chejennifer chejennifer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for completing the todo!!

return ''

# If key is not found, return an empty string
logging.warning(f'No key found for project: {gcp_project}; path:{gcp_path}')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not necessarily true because this is also a case of the key not found in the environment

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the log to include the environment variables that were also checked.

@beets beets requested a review from gmechali February 20, 2025 21:34
Copy link
Contributor

@gmechali gmechali left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow using a helper there makes a big difference! THank you!


TODO: use this method everywhere else in this file
"""
"""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ultra nit: might be nice to take this helper method into a helper file, to keep this a bit emptier.
Obviously you're not introducing this so no pressure to make the change now :) but at least a TODO would be good!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that send_email.py (link) and runner.py (link) reuse the same logic!

Do you have an idea for where this helper file should live and whether I should have send_email and runner use the same function? Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Chatted offline, will move to website/shared/lib/utils.py in follow up PR today!

@clincoln8 clincoln8 merged commit c774b61 into datacommonsorg:master Feb 21, 2025
9 checks passed
@clincoln8 clincoln8 deleted the init-api-helper branch February 21, 2025 19:42
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.

3 participants