feat: send S3 setup inputs to /setup

pull/243/head
Josh Moore 1 year ago
parent 15ee35d996
commit 8d545f1d37

@ -26,6 +26,7 @@ document.addEventListener('DOMContentLoaded', () => {
// * Setup button click handler // * Setup button click handler
Elements.submitButton.addEventListener('click', async () => { Elements.submitButton.addEventListener('click', async () => {
// Base configuration values
const config: UserConfiguration = { const config: UserConfiguration = {
uploadsDir: Elements.dirInput.value, uploadsDir: Elements.dirInput.value,
idType: Elements.idTypeInput.value as IdType, idType: Elements.idTypeInput.value as IdType,
@ -34,6 +35,23 @@ document.addEventListener('DOMContentLoaded', () => {
maximumFileSize: parseInt(Elements.fileSizeInput.value), 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', { fetch('/setup', {
method: 'POST', method: 'POST',
headers: { 'Content-Type': 'application/json' }, headers: { 'Content-Type': 'application/json' },

Loading…
Cancel
Save