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

Enables Using Environment Variable for Authorization - Issue #49 #114

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Tylerlhess
Copy link

Solves #49

Added an init option to the Gmail class to respect environment variable SIMPLEGMAIL_CREDENTIALS as an alternative to having the gmail_token.json.

Why:

This provides a solution for dockerizing a project using secrets. While you can mount a secret as a file within k8s and updating that file won't affect the pods operation this is not true with docker. This allows you to set the variable and the container build and manage the auth token file without reauthorization or having to give write permissions to each container sharing the same bind mount.

Use:

set the environment variable in the shell

export SIMPLEGMAIL_CREDENTIALS=$(cat gmail_token.json)  
# script.py
from simplegmail import Gmail

gmail = Gmail(use_envvars=True)

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