SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.
Go blob-storagecloud-drivedistributed-file-systemdistributed-storageerasure-codingfusehadoop-hdfshdfskuberneteslancelancedbobject-storageposixs3s3-storageseaweedfstiered-file-systemvector-search
feat(gcs): add application default credentials fallback support (#8161)
Peter Dodd4d513a2b3dda
diff --git a/weed/remote_storage/gcs/gcs_storage_client.go b/weed/remote_storage/gcs/gcs_storage_client.goindex b92f81b0fa..2d090ae6e8 100644--- a/weed/remote_storage/gcs/gcs_storage_client.go+++ b/weed/remote_storage/gcs/gcs_storage_client.go@@ -38,26 +38,26 @@ func (s gcsRemoteStorageMaker) Make(conf *remote_pb.RemoteConf) (remote_storage.googleApplicationCredentials := conf.GcsGoogleApplicationCredentialsif googleApplicationCredentials == "" {- found := false- googleApplicationCredentials, found = os.LookupEnv("GOOGLE_APPLICATION_CREDENTIALS")- if !found {- return nil, fmt.Errorf("need to specific GOOGLE_APPLICATION_CREDENTIALS env variable")+ if creds, found := os.LookupEnv("GOOGLE_APPLICATION_CREDENTIALS"); found {+ googleApplicationCredentials = creds+ } else {+ glog.Warningf("no GOOGLE_APPLICATION_CREDENTIALS env variable found, falling back to Application Default Credentials")}}projectID := conf.GcsProjectIdif projectID == "" {- found := false- projectID, found = os.LookupEnv("GOOGLE_CLOUD_PROJECT")- if !found {- glog.Warningf("need to specific GOOGLE_CLOUD_PROJECT env variable")+ if pid, found := os.LookupEnv("GOOGLE_CLOUD_PROJECT"); found {+ projectID = pid+ } else {+ glog.Warningf("need to specify GOOGLE_CLOUD_PROJECT env variable")}}- googleApplicationCredentials = util.ResolvePath(googleApplicationCredentials)-var clientOpts []option.ClientOption+if googleApplicationCredentials != "" {+ googleApplicationCredentials = util.ResolvePath(googleApplicationCredentials)var data []bytevar err errorif strings.HasPrefix(googleApplicationCredentials, "{") {