1
0
Fork 0
mirror of synced 2024-07-05 22:40:39 +12:00

Bringing back the old mechanism of returning the client library through a pre-signed URL, rather than always serving through the service.

This commit is contained in:
mike12345567 2024-04-24 15:37:47 +01:00
parent 2fc96549aa
commit 849253faba

View file

@ -13,23 +13,16 @@ export function clientLibraryPath(appId: string) {
* due to issues with the domain we were unable to continue doing this - keeping
* incase we are able to switch back to CDN path again in future.
*/
export function clientLibraryCDNUrl(appId: string, version: string) {
export function cloudClientLibraryUrl(appId: string, version: string) {
let file = clientLibraryPath(appId)
if (env.CLOUDFRONT_CDN) {
// append app version to bust the cache
if (version) {
file += `?v=${version}`
}
// don't need to use presigned for client with cloudfront
// file is public
return cloudfront.getUrl(file)
} else {
return objectStore.getPresignedUrl(env.APPS_BUCKET_NAME, file)
}
return objectStore.getPresignedUrl(env.APPS_BUCKET_NAME, file)
}
export function clientLibraryUrl(appId: string, version: string) {
let tenantId, qsParams: { appId: string; version: string; tenantId?: string }
if (env.isProd() && !env.SELF_HOSTED) {
return cloudClientLibraryUrl(appId, version)
}
try {
tenantId = getTenantId()
} finally {