Browse Source
Merge pull request #2295 from asfaltboy/ps/make-app-creds-optional
fix: make GOOGLE_APPLICATION_CREDENTIALS optional
pull/2380/head
Hiroki Nakayama
3 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
8 additions and
1 deletions
-
backend/config/settings/gcp.py
|
|
@ -8,4 +8,11 @@ MIDDLEWARE.append("api.middleware.RangesMiddleware") # noqa: F405 |
|
|
|
DJANGO_DRF_FILEPOND_STORAGES_BACKEND = "storages.backends.gcloud.GoogleCloudStorage" |
|
|
|
GS_BUCKET_NAME = env("BUCKET_NAME", "doccano") |
|
|
|
GS_PROJECT_ID = env("GS_PROJECT_ID") |
|
|
|
GS_CREDENTIALS = service_account.Credentials.from_service_account_file(env("GOOGLE_APPLICATION_CREDENTIALS")) |
|
|
|
|
|
|
|
# for more details refer to |
|
|
|
# https://django-storages.readthedocs.io/en/latest/backends/gcloud.html#authentication-settings |
|
|
|
_google_application_credentials = env("GOOGLE_APPLICATION_CREDENTIALS", "") |
|
|
|
if _google_application_credentials: |
|
|
|
GS_CREDENTIALS = service_account.Credentials.from_service_account_file( |
|
|
|
_google_application_credentials |
|
|
|
) |