Merge pull request #13557 from Budibase/fix/pre-sign-client-lib
Changing client library to be retrieved via pre-signed URL for Cloud
This commit is contained in:
commit
36aacd4d11
|
@ -13,23 +13,16 @@ export function clientLibraryPath(appId: string) {
|
||||||
* due to issues with the domain we were unable to continue doing this - keeping
|
* 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.
|
* incase we are able to switch back to CDN path again in future.
|
||||||
*/
|
*/
|
||||||
export function clientLibraryCDNUrl(appId: string, version: string) {
|
function cloudClientLibraryUrl(appId: string) {
|
||||||
let file = clientLibraryPath(appId)
|
let file = clientLibraryPath(appId)
|
||||||
if (env.CLOUDFRONT_CDN) {
|
return objectStore.getPresignedUrl(env.APPS_BUCKET_NAME, file)
|
||||||
// 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)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function clientLibraryUrl(appId: string, version: string) {
|
export function clientLibraryUrl(appId: string, version: string) {
|
||||||
let tenantId, qsParams: { appId: string; version: string; tenantId?: string }
|
let tenantId, qsParams: { appId: string; version: string; tenantId?: string }
|
||||||
|
if (env.isProd() && !env.SELF_HOSTED) {
|
||||||
|
return cloudClientLibraryUrl(appId)
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
tenantId = getTenantId()
|
tenantId = getTenantId()
|
||||||
} finally {
|
} finally {
|
||||||
|
|
Loading…
Reference in New Issue