-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy paths3cmd-wrapper
More file actions
executable file
·44 lines (37 loc) · 841 Bytes
/
s3cmd-wrapper
File metadata and controls
executable file
·44 lines (37 loc) · 841 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
S3CMD=s3cmd
PROPERTIES=
while [[ $# > 1 ]]; do
case $1 in
-f)
shift
PROPERTIES=$1
shift
;;
*)
break
;;
esac
done
function extract_property {
prop=$1
fgrep $1= $PROPERTIES | cut -d= -f 2
}
if [ "$PROPERTIES" != "" ]; then
IDENTITY=$(extract_property s3proxy.identity)
CREDENTIAL=$(extract_property s3proxy.credential)
BOUNCE_PORT=$(extract_property s3proxy.endpoint | cut -d: -f 3)
BOUNCE_IP=$(sudo docker inspect --format '{{ .NetworkSettings.IPAddress }}' bounce-proxy)
if [ $? != 0 ]; then
BOUNCE_IP=127.0.0.1
fi
$S3CMD -c /dev/stdin $@ <<EOF
[default]
access_key = $IDENTITY
secret_key = $CREDENTIAL
host_base = $BOUNCE_IP:$BOUNCE_PORT
host_bucket = $BOUNCE_IP:$BOUNCE_PORT
EOF
else
$S3CMD $@
fi