forked from wahyd4/aria2-ariang-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcaddy.sh
executable file
·31 lines (24 loc) · 868 Bytes
/
caddy.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
#! /bin/bash -eu
echo "Run aria2c and ariaNG"
echo "**** Generate basic auth password for caddy ****"
ARIA2_PWD_ENCRYPT=$(caddy hash-password -plaintext ${ARIA2_PWD})
case $ENABLE_AUTH in
true)
echo "Using Basic Auth config file "
export CADDY_FILE=/usr/local/caddy/SecureCaddyfile
sed -i 's/ARIA2_USER/'"${ARIA2_USER}"'/g' ${CADDY_FILE}
sed -i 's/ARIA2_PWD_ENCRYPT/'"${ARIA2_PWD_ENCRYPT}"'/g' ${CADDY_FILE}
;;
heroku)
echo "Running in Heroku mode"
export CADDY_FILE=/usr/local/caddy/HerokuCaddyfile
sed -i 's/ARIA2_USER/'"${ARIA2_USER}"'/g' ${CADDY_FILE}
sed -i 's/ARIA2_PWD_ENCRYPT/'"${ARIA2_PWD_ENCRYPT}"'/g' ${CADDY_FILE}
sed -i 's/PORT/'"${PORT}"'/g' ${CADDY_FILE}
;;
*)
echo "Using caddy without Basic Auth"
export CADDY_FILE=/usr/local/caddy/Caddyfile
;;
esac
/usr/local/bin/caddy run -config ${CADDY_FILE} -adapter=caddyfile