diff --git a/src/scripts/backuptests3.sh b/src/scripts/backuptests3.sh deleted file mode 100755 index 7d8321247..000000000 --- a/src/scripts/backuptests3.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - -set -eu -o pipefail - -readonly s3_url="$1" -export AWS_ACCESS_KEY_ID="$2" -export AWS_SECRET_ACCESS_KEY="$3" -export AWS_DEFAULT_REGION="$4" -readonly endpoint_url="$5" - -optional_args="" - -if [ -n "${endpoint_url}" ]; then - optional_args="--endpoint-url ${endpoint_url}" -fi - -echo "Test Content" | aws ${optional_args} s3 cp - "${s3_url}" - -aws ${optional_args} s3 rm "${s3_url}" diff --git a/src/storage/s3.js b/src/storage/s3.js index 0c2ba1839..731ae5b40 100644 --- a/src/storage/s3.js +++ b/src/storage/s3.js @@ -24,7 +24,6 @@ var archiver = require('archiver'), once = require('once'), path = require('path'), SettingsError = require('../settings.js').SettingsError, - shell = require('../shell.js'), tar = require('tar-fs'), zlib = require('zlib'); @@ -259,14 +258,12 @@ function testConfig(apiConfig, callback) { if (typeof apiConfig.prefix !== 'string') return callback(new SettingsError(SettingsError.BAD_FIELD, 'prefix must be a string')); // attempt to upload and delete a file with new credentials - // First use the javascript api, to get better feedback, then use aws cli tool - // The javascript api always autodetects the correct settings, regardless of the region provided, the cli tool does not getBackupCredentials(apiConfig, function (error, credentials) { if (error) return callback(error); var params = { Bucket: apiConfig.bucket, - Key: apiConfig.prefix + '/testfile', + Key: apiConfig.prefix + '/cloudron-testfile', Body: 'testcontent' }; @@ -276,23 +273,13 @@ function testConfig(apiConfig, callback) { var params = { Bucket: apiConfig.bucket, - Key: apiConfig.prefix + '/testfile' + Key: apiConfig.prefix + '/cloudron-testfile' }; s3.deleteObject(params, function (error) { if (error) return callback(new SettingsError(SettingsError.EXTERNAL_ERROR, error.message)); - // now perform the same as what we do in the backup shell scripts - var BACKUP_TEST_CMD = require('path').join(__dirname, '../scripts/backuptests3.sh'); - var tmpUrl = 's3://' + apiConfig.bucket + '/' + apiConfig.prefix + '/testfile'; - var args = [ tmpUrl, credentials.accessKeyId, credentials.secretAccessKey, credentials.region, credentials.endpoint || '' ]; - - // if this fails the region is wrong, otherwise we would have failed earlier. - shell.exec('backupTestS3', BACKUP_TEST_CMD, args, function (error) { - if (error) return callback(new SettingsError(SettingsError.EXTERNAL_ERROR, 'Wrong region')); - - callback(); - }); + callback(); }); }); });