mirror of
https://gh.llkk.cc/https://github.com/WeblateOrg/scripts.git
synced 2025-10-03 15:01:00 +08:00
chore: apply shfmt
This commit is contained in:
parent
78892e5652
commit
d5780ab4ee
13 changed files with 110 additions and 116 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue