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

Add Support for Google Secret Manager as a Source #168

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Dresdn
Copy link

@Dresdn Dresdn commented Nov 8, 2023

Original Credit: https://www.codingforentrepreneurs.com/blog/google-secrets-python-decouple-github-actions/

Working with Google Secret Manager, the config is provided back as a string. To support the format, a RepositoryString class has been created which parses a string in .env format.

@Dresdn
Copy link
Author

Dresdn commented Nov 8, 2023

@henriquebastos - if you're in agreement to support this, I can take some time to update the Readme with the new option.

@felciano
Copy link

I was just looking for this! Thanks for contributing @Dresdn I hope this gets accepted soon

@henriquebastos
Copy link
Collaborator

@Dresdn thank you for your contribution.

  1. Is this literally the same as the RepositoryEnv minus opening the file?
  2. Or is this a Google-specific string format?

In case of 1, it would be nice to refactor RepositoryEnv extending RepositoryString, but we can do it later.

In case of 2, maybe RepositoryString should be RepositoryGoogleManager or something more descriptive.

Wdyt?

@Dresdn
Copy link
Author

Dresdn commented Jan 2, 2024

Those are great ideas @henriquebastos, and apologize for being lazy and plopping in the class I used in my project.

For 1, I was trying not to make it specific to Google since it's a generic format, but looking at other secret managers, they seem to all manage them differently (some have dicts, some return one value at a time). Maybe just renaming it RepositoryGoogleSecretManager would be best.

For 2, should we create a BaseRepositoryDict or something that declares the __contains__() and __getitem__() and have RepositoryEnv and RepositoryGoogleSecretManager extend that? I'm probably over-thinking it, but the thought process would be other managers that use dicts.

Let me know your thoughts and I'll clean up the PR and add some documentation too.

@Dresdn Dresdn force-pushed the repository-string branch 2 times, most recently from 621e6bb to 8ac622c Compare January 20, 2024 20:27
@Dresdn
Copy link
Author

Dresdn commented Jan 20, 2024

This should be ready to go @henriquebastos (minus my default editor settings trying to change everything). I ended up just extending RepositoryEnv and renaming the class to better reflect the purpose.

@Dresdn Dresdn changed the title Add Support for string as a Source Add Support for Google Secret Manager as a Source Jan 20, 2024
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.

None yet

3 participants