Skip to content

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