-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhelper.sh
executable file
·60 lines (49 loc) · 1.05 KB
/
helper.sh
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash
[ ! -d './tmp' ] && mkdir tmp
if [ -z $1 ]
then
echo "Mode not set!"
exit 1
fi
if [ -z $AZURE_STORAGE_ACCOUNT ]
then
echo "Variable AZURE_STORAGE_ACCOUNT is not set"
exit 1
fi
if [ -z $AZURE_STORAGE_KEY ]
then
echo "Variable AZURE_STORAGE_KEY is not set"
exit 1
fi
if [ "$1" = "auth" ]
then
if [ -z $CERTBOT_VALIDATION ]
then
echo "Variable CERTBOT_VALIDATION is not set"
exit 1
fi
if [ -z $CERTBOT_TOKEN ]
then
echo "Variable CERTBOT_TOKEN is not set"
exit 1
fi
echo $CERTBOT_VALIDATION > ./tmp/$CERTBOT_TOKEN
az storage blob upload-batch \
--overwrite \
--destination '$web' \
--source ./tmp \
--destination-path '.well-known/acme-challenge' \
--auth-mode key
exit 0
elif [ "$1" = "cleanup" ]
then
az storage blob delete-batch \
--source '$web' \
--pattern '.well-known/acme-challenge/*' \
--auth-mode key
rm -rf tmp/
exit 0
else
echo "Unknown mode"
exit 1
fi