MCPcopy Index your code
hub / github.com/simstudioai/sim / parseConnectionString

Function parseConnectionString

apps/sim/lib/uploads/providers/blob/client.ts:33–48  ·  view source on GitHub ↗

* Extract account name and key from an Azure connection string. * Connection strings have the format: DefaultEndpointsProtocol=https;AccountName=...;AccountKey=...;EndpointSuffix=...

(connectionString: string)

Source from the content-addressed store, hash-verified

31 * Connection strings have the format: DefaultEndpointsProtocol=https;AccountName=...;AccountKey=...;EndpointSuffix=...
32 */
33function parseConnectionString(connectionString: string): ParsedCredentials {
34 const accountNameMatch = connectionString.match(/AccountName=([^;]+)/)
35 if (!accountNameMatch) {
36 throw new Error('Cannot extract account name from connection string')
37 }
38
39 const accountKeyMatch = connectionString.match(/AccountKey=([^;]+)/)
40 if (!accountKeyMatch) {
41 throw new Error('Cannot extract account key from connection string')
42 }
43
44 return {
45 accountName: accountNameMatch[1],
46 accountKey: accountKeyMatch[1],
47 }
48}
49
50/**
51 * Get account credentials from BLOB_CONFIG, extracting from connection string if necessary.

Callers 3

getAccountCredentialsFunction · 0.85
getMultipartPartUrlsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected