Closed MaykGyver closed 6 months ago
Hi there. I used your script and stumbled upon ignorance of arguments use_ssl and port. (See Nextcloud's documentation on object storage for details)
The fix is easy. In localtos3.php I added and modified five lines so now it reads:
[snip] echo "\nconnect to S3..."; $bucket = $CONFIG['objectstore']['arguments']['bucket']; $proto = isset($CONFIG['objectstore']['arguments']['use_ssl']) ? $CONFIG['objectstore']['arguments']['use_ssl'] : true; // ← added line $proto = $proto ? 'https' : 'http'; // ← added line $port = isset($CONFIG['objectstore']['arguments']['port']) ? $CONFIG['objectstore']['arguments']['port'] : 443; // ← added line if($CONFIG['objectstore']['arguments']['use_path_style']){ $s3 = new S3Client([ 'version' => 'latest', 'endpoint' => $proto.'://'.$CONFIG['objectstore']['arguments']['hostname'].':'.$port.'/'.$bucket, // ← modified line 'bucket_endpoint' => true, 'use_path_style_endpoint' => true, 'region' => $CONFIG['objectstore']['arguments']['region'], 'credentials' => [ 'key' => $CONFIG['objectstore']['arguments']['key'], 'secret' => $CONFIG['objectstore']['arguments']['secret'], ], ]); }else{ $s3 = new S3Client([ 'version' => 'latest', 'endpoint' => $proto.'://'.$bucket.'.'.$CONFIG['objectstore']['arguments']['hostname'].':'.$port, // ← modified line 'bucket_endpoint' => true, 'region' => $CONFIG['objectstore']['arguments']['region'], 'credentials' => [ 'key' => $CONFIG['objectstore']['arguments']['key'], 'secret' => $CONFIG['objectstore']['arguments']['secret'], ], ]); } [snip]
I'm not too dexterous with pull requests yet. So please excuse that I submit the fix this way. I'd love to follow the "official" process. Assistance/consulting on that would be really appreciated. I'm willing to learn.
@MaykGyver thanks for your input, I have altered both localtos3 and s3tolocal
Hi there. I used your script and stumbled upon ignorance of arguments use_ssl and port. (See Nextcloud's documentation on object storage for details)
The fix is easy. In localtos3.php I added and modified five lines so now it reads:
I'm not too dexterous with pull requests yet. So please excuse that I submit the fix this way. I'd love to follow the "official" process. Assistance/consulting on that would be really appreciated. I'm willing to learn.