Commit 1bbd3373 authored by Romain Maliach-Auguste's avatar Romain Maliach-Auguste 🌵
Browse files

Load APIKEY file from env variable

parent eb9aa12b
# Dockerfile for `delete_pad_after_delay` # Dockerfile for `delete_pad_after_delay`
This directory only contains an init script. It will grab the `$DIR`, `$URL` and `$DEL` environment variables and pass them to `delete_pad_after_delay`. The API key will be read from the `/APIKEY.txt` file (it must be mounted somehow). You could check picasoft's docker-compose.yml as an example. Only one instance is supported, it is (internally) named `instanceD`. This directory only contains an init script. It will grab the `$DIR`, `$URL` and `$DEL` environment variables and pass them to `delete_pad_after_delay`. The API key will be read from a file specified with the `$APIKEY_PATH` variable (it must be mounted or written somehow). You could check picasoft's docker-compose.yml as an example. Only one instance is supported, it is (internally) named `instanceD`.
#!/bin/bash #!/bin/bash
let retries=10 let retries=10
api_key_retry_delay=30 api_key_retry_delay=30
while [ $retries -gt 0 ] && [ -v $(cat /APIKEY.txt) ] ; do >&2 echo "/APIKEY.txt must contain the etherpad instance's API key. Copy (or mount) it. It is generated by etherpad-lite at startup and placed in its root (usually /opt/etherpad-lite/APIKEY.txt). We'll trying again $retries more times, after having slept $api_key_retry_delay seconds."; sleep $api_key_retry_delay; let retries--; done while [ $retries -gt 0 ] && [ -v $(cat $APIKEY_PATH) ] ; do >&2 echo "APIKEY file (at $APIKEY_PATH ) must contain the etherpad instance's API key. Copy (or mount) it. It is generated by etherpad-lite at startup and placed in its root (usually /opt/etherpad-lite/APIKEY.txt). We'll trying again $retries more time(s), after having slept $api_key_retry_delay seconds."; sleep $api_key_retry_delay; let retries--; done
if [ $retries == 0 ] ; then >&2 echo "Failed to find /APIKEY.txt, aborting."; exit 1; fi if [ $retries == 0 ] ; then >&2 echo "Failed to find APIKEY file (at $APIKEY_PATH ), aborting."; exit 1; fi
CF=/etc/delete_after_delay.yml CF=/etc/delete_after_delay.yml
echo 'instanceD:' > $CF echo 'instanceD:' > $CF
echo " key: $(cat /APIKEY.txt)" >> $CF echo " key: $(cat $APIKEY_PATH)" >> $CF
echo " dir: $DIR" >> $CF echo " dir: $DIR" >> $CF
echo " url: $URL" >> $CF echo " url: $URL" >> $CF
echo " del: $DEL" >> $CF echo " del: $DEL" >> $CF
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment