chore: apply shfmt

This commit is contained in:
Michal Čihař 2025-04-08 11:35:17 +02:00
parent 78892e5652
commit d5780ab4ee
13 changed files with 110 additions and 116 deletions

View file

@ -3,22 +3,22 @@
KEY="$(sed -n '/^env.KEY/ s/^env.KEY \(.*\)/\1/p' /etc/munin/plugin-conf.d/weblate_servers)"
SERVER="$(sed -n '/^env.SERVER/ s/^env.SERVER \(.*\)/\1/p' /etc/munin/plugin-conf.d/weblate_servers)"

if [ -z "$SERVER" ] ; then
if [ -z "$SERVER" ]; then
echo "Missing server configuration!"
exit 1
fi

if [ -n "$KEY" ] ; then
if ! curl -f -s -H "Authorization: Token $KEY" "${SERVER}api/metrics/" -o /dev/null ; then
if [ -n "$KEY" ]; then
if ! curl -f -s -H "Authorization: Token $KEY" "${SERVER}api/metrics/" -o /dev/null; then
echo "Key not working, recreating"
KEY=""
fi
fi

if [ -z "$KEY" ] ; then
if [ -z "$KEY" ]; then

echo "Generating new key"
if [ -f "/home/weblate/weblate/docker-compose.override.yml" ] ; then
if [ -f "/home/weblate/weblate/docker-compose.override.yml" ]; then
cd /home/weblate/weblate || exit 1
KEY="$(sudo -u weblate docker compose exec --user weblate weblate weblate shell -c 'from weblate.auth.models import User; user = User.objects.create(username="monitor"); print(user.auth_token.key)')"
else