@@ -6,6 +6,7 @@ const { DownloadCenter } = require('@mongodb-js/dl-center');
66const download = require ( 'download' ) ;
77
88const DOWNLOADS_BUCKET = 'downloads.10gen.com' ;
9+ const DOWNLOADS_BUCKET_NEW = 'cdn-origin-compass' ;
910const MANIFEST_BUCKET = 'info-mongodb-com' ;
1011const MANIFEST_OBJECT_KEY = 'com-download-center/compass.json' ;
1112
@@ -32,10 +33,31 @@ const getDownloadCenter = (bucketConfig) => {
3233 } ) ;
3334} ;
3435
36+ const getDownloadCenterNew = ( bucketConfig ) => {
37+ requireEnvironmentVariables ( [
38+ 'DOWNLOAD_CENTER_NEW_AWS_ACCESS_KEY_ID' ,
39+ 'DOWNLOAD_CENTER_NEW_AWS_SECRET_ACCESS_KEY' ,
40+ 'DOWNLOAD_CENTER_NEW_AWS_SESSION_TOKEN' ,
41+ ] ) ;
42+
43+ return new DownloadCenter ( {
44+ ...bucketConfig ,
45+ accessKeyId : process . env . DOWNLOAD_CENTER_NEW_AWS_ACCESS_KEY_ID ,
46+ secretAccessKey : process . env . DOWNLOAD_CENTER_NEW_AWS_SECRET_ACCESS_KEY ,
47+ sessionToken : process . env . DOWNLOAD_CENTER_NEW_AWS_SESSION_TOKEN ,
48+ } ) ;
49+ } ;
50+
3551const getKeyPrefix = ( channel ) => {
3652 return channel && channel !== 'stable' ? `compass/${ channel } ` : 'compass' ;
3753} ;
3854
55+ const uploadAssetNew = async ( channel , asset ) => {
56+ const dlCenterNew = getDownloadCenterNew ( { bucket : DOWNLOADS_BUCKET_NEW } ) ;
57+ const objectKey = `${ getKeyPrefix ( channel ) } /${ asset . name } ` ;
58+ return dlCenterNew . uploadAsset ( objectKey , fs . createReadStream ( asset . path ) ) ;
59+ } ;
60+
3961const uploadAsset = async ( channel , asset ) => {
4062 const dlCenter = getDownloadCenter ( { bucket : DOWNLOADS_BUCKET } ) ;
4163 const objectKey = `${ getKeyPrefix ( channel ) } /${ asset . name } ` ;
0 commit comments