docker-s3-sync
docker-s3-sync copied to clipboard
Use the S3 key as the default ouput file name
@cleung2010 Hi! Thank you for using docker-s3-sync
.
Were you having a problem that this change fixed? Curious what the motivation is for this pull request.
I would think that setting the DESTINATION
path would be like cp
or mv
, where if you you don't specify the filename, the target file will have the same name as the source. Currently if the destination is a directory, the filename will default to out
which is a bit odd.
Currently if the destination is a directory, the filename will default to out which is a bit odd.
Oh, good point. I'd always fully specified the destination instead of giving a directory.
What about the case when the S3 key contains slashes? For example, path/to/s3_file
.
Would you expect the file to live in /destination/path/to/s3_file
? In that case, you'll need to mkdir -p $(dirname $S3_KEY)
.
If you'd expect it to live in /destination/s3_file
, you'll want to write the file to $(basename $S3_KEY)
.
Right, I don't know what is the right call here, whether it should be /destination/path/to/s3_file
or /destination/s3_file
.
Actually, if the image is used to sync a single file I think it would make more sense to use $(basename $S3_KEY)
rather than making the directory tree for the file.
Also encountered a potential problem with the sync.sh
. If OWNER_UID
is not provided, the file will be owned by root:root, but the mv
command might get permission denied if sync.sh is not executed by root. Changing it to cp
eliminated the problem since the file is globally readable by default.