From 8d545f1d37c6a7166e6de980ecdd57263529106b Mon Sep 17 00:00:00 2001 From: Josh Moore Date: Sun, 16 Jul 2023 14:26:30 -0600 Subject: [PATCH] feat: send S3 setup inputs to /setup --- frontend/setup.mts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/frontend/setup.mts b/frontend/setup.mts index cbf4422..f2e21d0 100644 --- a/frontend/setup.mts +++ b/frontend/setup.mts @@ -26,6 +26,7 @@ document.addEventListener('DOMContentLoaded', () => { // * Setup button click handler Elements.submitButton.addEventListener('click', async () => { + // Base configuration values const config: UserConfiguration = { uploadsDir: Elements.dirInput.value, idType: Elements.idTypeInput.value as IdType, @@ -34,6 +35,23 @@ document.addEventListener('DOMContentLoaded', () => { maximumFileSize: parseInt(Elements.fileSizeInput.value), }; + // Append S3 to config, if specified + if (Elements.s3endpoint.value != null && Elements.s3endpoint.value !== '') { + config.s3 = { + endpoint: Elements.s3endpoint.value, + bucket: Elements.s3bucket.value, + credentials: { + accessKey: Elements.s3accessKey.value, + secretKey: Elements.s3secretKey.value + } + }; + + // Also append region, if it was provided + if (Elements.s3region.value != null && Elements.s3region.value !== '') + config.s3.region = Elements.s3region.value; + } + + // Do setup fetch('/setup', { method: 'POST', headers: { 'Content-Type': 'application/json' },