Skip to content

Commit a6dc0bc

Browse files
author
Amir Tocker
committed
Add script to create unsigned upload preset for the Android test
1 parent 4a4c6d5 commit a6dc0bc

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env bash
2+
3+
# Create the unsigned upload preset required for tests
4+
# Currently only required for the Android test since Android API cannot create the preset
5+
6+
UNSIGNED_PRESET="cloudinary_java_test"
7+
SDK_TEST_TAG="cloudinary_java_test"
8+
9+
if [ -z ${CLOUDINARY_URL+x} ]
10+
then echo "The variable CLOUDINARY_URL must be set!"
11+
else
12+
13+
API_CRED=${CLOUDINARY_URL%@*}
14+
API_CRED=${API_CRED#*//}
15+
if curl -s "https://${API_CRED#*//}@api.cloudinary.com/v1_1/${CLOUDINARY_URL#*@}/upload_presets/${UNSIGNED_PRESET}" | \
16+
grep --quiet "Can't find upload preset named"
17+
then curl --data "name=${UNSIGNED_PRESET}&unsigned=true&tags=${TAG}" \
18+
"https://${API_CRED#*//}@api.cloudinary.com/v1_1/${CLOUDINARY_URL#*@}/upload_presets"
19+
echo
20+
else
21+
echo "Preset already exists"
22+
fi
23+
fi

0 commit comments

Comments
 (0)