diff --git a/app/data/index.mjs b/app/data/index.mjs index d232771..03b1561 100644 --- a/app/data/index.mjs +++ b/app/data/index.mjs @@ -43,6 +43,11 @@ export async function update(config = 'default') { let settings = configs[config]; + // Download private files to get updated tokens if needed + if (canSync()) { + await (new S3Syncer).download(false); + } + await Promise.all(updaters().map(async updater => { updater.settings = settings; try { diff --git a/app/sync/S3Syncer.mjs b/app/sync/S3Syncer.mjs index 0240660..911eac6 100644 --- a/app/sync/S3Syncer.mjs +++ b/app/sync/S3Syncer.mjs @@ -5,14 +5,14 @@ import mime from 'mime-types'; export default class S3Syncer { - download() { + download(dist = true, storage = true) { this.log('Downloading files...'); return Promise.all([ - this.syncClient.sync(this.publicBucket, `${this.localPath}/dist`, { + dist && this.syncClient.sync(this.publicBucket, `${this.localPath}/dist`, { filters: this.filters, }), - this.syncClient.sync(this.privateBucket, `${this.localPath}/storage`, { + storage && this.syncClient.sync(this.privateBucket, `${this.localPath}/storage`, { filters: this.privateFilters, }), ]);