* Get account credentials from BLOB_CONFIG, extracting from connection string if necessary.
()
| 51 | * Get account credentials from BLOB_CONFIG, extracting from connection string if necessary. |
| 52 | */ |
| 53 | function getAccountCredentials(): ParsedCredentials { |
| 54 | if (BLOB_CONFIG.connectionString) { |
| 55 | return parseConnectionString(BLOB_CONFIG.connectionString) |
| 56 | } |
| 57 | |
| 58 | if (BLOB_CONFIG.accountName && BLOB_CONFIG.accountKey) { |
| 59 | return { |
| 60 | accountName: BLOB_CONFIG.accountName, |
| 61 | accountKey: BLOB_CONFIG.accountKey, |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | throw new Error( |
| 66 | 'Azure Blob Storage credentials are missing – set AZURE_CONNECTION_STRING or both AZURE_ACCOUNT_NAME and AZURE_ACCOUNT_KEY' |
| 67 | ) |
| 68 | } |
| 69 | |
| 70 | export async function getBlobServiceClient(): Promise<BlobServiceClientType> { |
| 71 | if (_blobServiceClient) return _blobServiceClient |
no test coverage detected