MCPcopy
hub / github.com/diffgram/diffgram / set_gcp_credentials

Method set_gcp_credentials

install.py:91–120  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

89 self.static_storage_provider = 'minio'
90
91 def set_gcp_credentials(self):
92 is_valid = False
93 self.use_docker_minio = False
94 # Ask For Service Account
95 while not is_valid:
96 f = None
97 service_account_path = bcolors.inputcolor(
98 'Please provide the Full Path of your GCP service account JSON file: ')
99 try:
100 if not service_account_path.endswith('.json'):
101 bcolors.printcolor('ERROR: Path must be a JSON file', bcolors.WARNING)
102 is_valid = False
103 continue
104 f = open(service_account_path)
105 # Do something with the file
106 self.gcp_credentials_path = service_account_path
107 is_valid = True
108 except IOError:
109 bcolors.printcolor(
110 "Invalid path, make sure your are writing the full path to your GCP credentials JSON file",
111 bcolors.FAIL)
112 finally:
113 if f:
114 f.close()
115 # Ask for bucket name
116 bucket_name = bcolors.inputcolor('Please provide the GCP Storage Bucket Name [Default is diffgram-storage]: ')
117 if bucket_name == '':
118 self.bucket_name = 'diffgram-storage'
119 else:
120 self.bucket_name = bucket_name
121
122 def validate_azure_connection(self):
123 connection_string = self.azure_connection_string

Callers 1

installMethod · 0.95

Calls 2

inputcolorMethod · 0.80
printcolorMethod · 0.80

Tested by

no test coverage detected