Refactor method of retrieving credentials out of VCAP_SERVICES

This commit is contained in:
Ryan Ahearn
2022-10-20 08:03:32 -04:00
parent d87d673b85
commit 921c872bd1
10 changed files with 132 additions and 178 deletions

View File

@@ -44,21 +44,25 @@ class ContactList(JSONModel):
contact_list_id=contact_list_id,
))
@staticmethod
def get_bucket_credentials(key):
return current_app.config['CONTACT_LIST_BUCKET'][key]
@staticmethod
def get_bucket_name():
return current_app.config['CONTACT_LIST_UPLOAD_BUCKET_NAME']
return ContactList.get_bucket_credentials('bucket')
@staticmethod
def get_access_key():
return current_app.config['CONTACT_LIST_UPLOAD_ACCESS_KEY']
return ContactList.get_bucket_credentials('access_key_id')
@staticmethod
def get_secret_key():
return current_app.config['CONTACT_LIST_UPLOAD_SECRET_KEY']
return ContactList.get_bucket_credentials('secret_access_key')
@staticmethod
def get_region():
return current_app.config['CONTACT_LIST_UPLOAD_REGION']
return ContactList.get_bucket_credentials('region')
@staticmethod
def get_filename(service_id, upload_id):