django-gcloud-storage icon indicating copy to clipboard operation
django-gcloud-storage copied to clipboard

Use credentials from a string

Open IlyaSemenov opened this issue 4 years ago • 2 comments

For some reason django-gcloud-storage needs Google SA credentials specifically stored in a file, which contracts the modern 12 factor approach where the apps/containers are stateless and everything is passed via environment variables.

Will you please add support for GCS_CREDENTIALS (as opposed to GCS_CREDENTIALS_FILE_PATH)? gcloud itself already supports it with storage.Client(credentials=google.auth.jwt.Credentials.from_service_account_info(json.load(base64.b64decode(settings.GCS_CREDENTIALS).decode("utf-8")))) (vs. storage.Client.from_service_account_json)

IlyaSemenov avatar May 22 '20 12:05 IlyaSemenov

This would probably be a simple change mostly here. Feel free to open a PR with this. Alternatively this may already be possible with django-storages, since it supports gcloud natively for a while now.

strayer avatar May 22 '20 12:05 strayer

Thank you, django-storages worked for me.

IlyaSemenov avatar May 22 '20 13:05 IlyaSemenov