mastoGem/start.sh

52 lines
850 B
Bash

#! /bin/sh
if [ -z "$MASTODON_BASE_URL" ]
then
echo "You must set the MASTODON_BASE_URL variable"
exit 1
fi
if [ ! -f /cert.pem ]
then
echo "You must bind a certificate at /cert.pem"
exit 1
fi
if [ ! -f /key.rsa ]
then
echo "You must bind a private key at /key.rsa"
exit 1
fi
if [ -z "$TITLE" ]
then
echo "Using default title"
TITLE=MastoGem
fi
if [ -z "$HOME_MESSAGE" ]
then
echo "Using default home message"
HOME_MESSAGE="Welcome on MastoGem, a Mastodon proxy for Gemini !"
fi
if [ -z "$RATE_LIMIT" ]
then
echo "Using default rate limit"
RATE_LIMIT=45
fi
cat << EOF > /config.json
{
"listen": "0.0.0.0:1965",
"cert_path": "/cert.pem",
"key_path": "/key.rsa",
"base_url": "$MASTODON_BASE_URL",
"title": "$TITLE",
"home_message": "$HOME_MESSAGE",
"rate_limit": $RATE_LIMIT
}
EOF
MASTOGEM_CONFIG_PATH=/config.json /mastogem