-
Notifications
You must be signed in to change notification settings - Fork 9
/
runstampy
executable file
·38 lines (34 loc) · 999 Bytes
/
runstampy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/sh
get_secret () {
VAR_NAME="${1}"
GIVEN_PATH="${2}"
if [ -e "${GIVEN_PATH}" ]; then
export ${VAR_NAME}="$(cat ${GIVEN_PATH})"
fi
}
get_secret "DISCORD_TOKEN" "~/.discordtoken"
get_secret "DISCORD_GUILD" "~/.discordguild"
get_secret "YOUTUBE_API_KEY" "~/.youtubeapikey"
get_secret "CLIENT_SECRET_PATH" "~/.clientsecretpath"
get_secret "OPENAI_API_KEY" "~/.openaikey";
get_secret "WOLFRAM_TOKEN" "~/.wolframtoken";
get_secret "SLACK_APP_TOKEN" "~/.slackapptoken";
get_secret "SLACK_BOT_TOKEN" "~/.slackbottoken";
if [ "${STAMPY_RUN_TESTS:-nil}" != "nil" ]; then
pip install -qr ./requirements_test.txt
pytest;
python -m unittest;
mypy -m stam;
pylint stam;
else
while true; do
python stam.py
EXIT_CODE=$?
# echo "Return code: ${EXIT_CODE}" # DEBUG
if [ "${STOP_ON_ERROR:-nil}" != "nil" ] && [ $EXIT_CODE != "42" ]; then
exit 0
fi
sleep 0.5;
done
fi
# also run CommentPoster.py