Skip to content

Commit

Permalink
Replaced tg.py with cURL in example
Browse files Browse the repository at this point in the history
  • Loading branch information
dmotte committed Nov 22, 2023
1 parent 2b11135 commit be28d2b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 42 deletions.
39 changes: 0 additions & 39 deletions example/build/setup/lognot/tg.py

This file was deleted.

9 changes: 9 additions & 0 deletions example/build/setup/lognot/tg.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

set -e

bot_token='{{ lognot_bot_token }}'
chat_id='{{ lognot_chat_id }}'

curl -sSXPOST "https://api.telegram.org/bot$bot_token/sendMessage" \
-dchat_id="$chat_id" --data-urlencode text@- --fail-with-body -w'\n'
6 changes: 3 additions & 3 deletions example/build/setup/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,17 @@ chmod 700 /opt/startup-{early,late}
# while read -r i; do echo "$HOSTNAME: $i"; done |
# /opt/lognot/venv/bin/python3 -um msgbuf \
# -l INFO -i 10 -m 2048 -f /opt/lognot/buffer.txt \
# /opt/lognot/venv/bin/python3 /opt/lognot/tg.py'
# /bin/bash /opt/lognot/tg.sh'
# priority=50
# EOF

install -dm700 /opt/lognot
install -m700 /{setup,opt}/lognot/get.sh
python3 -m venv /opt/lognot/venv
/opt/lognot/venv/bin/pip3 install 'requests==2.*' 'msgbuf==1.*'
install -m600 /{setup,opt}/lognot/tg.py
install -m700 /{setup,opt}/lognot/tg.sh
cat << 'EOF' > /opt/startup-late/50-lognot-secrets.sh
sed -i /opt/lognot/tg.py \
sed -i /opt/lognot/tg.sh \
-e "s/{{ lognot_bot_token }}/$LOGNOT_BOT_TOKEN/" \
-e "s/{{ lognot_chat_id }}/$LOGNOT_CHAT_ID/"
unset LOGNOT_{BOT_TOKEN,CHAT_ID}
Expand Down

0 comments on commit be28d2b

Please sign in to comment.