oracolo-docker/entrypoint.sh

63 lines
2.7 KiB
Bash
Raw Permalink Normal View History

2024-05-27 16:19:52 +02:00
#!/bin/sh
echo
2024-05-28 21:34:47 +02:00
echo " ___ ____ ____ __ ___ _ ___ ";
echo " / \ | \ / | / ] / \ | | / \ ";
echo "| || D )| o | / / | || | | |";
echo "| O || / | |/ / | O || |___ | O |";
echo "| || \ | _ / \_ | || || |";
echo "| || . \| | \ || || || |";
echo " \___/ |__|\_||__|__|\____| \___/ |_____| \___/ ";
2024-05-30 15:03:56 +02:00
echo " ";
2024-05-27 16:19:52 +02:00
echo "Oracolo dtonon's repo: https://github.com/dtonon/oracolo"
2024-05-30 15:03:56 +02:00
echo "Docker image repo: https://github.com/PastaGringo/oracolo-docker"
2024-05-27 16:19:52 +02:00
echo
2024-05-30 15:03:56 +02:00
echo "╭───────────────────────╮"
echo "│ Docker Env Vars... ⤵️ │"
echo "╰───────────────────────╯"
2024-05-27 16:19:52 +02:00
echo
2024-06-06 21:56:18 +02:00
echo "> NPUB : $NPUB"
echo "> RELAYS : $RELAYS"
echo "> TOP_NOTES : $TOP_NOTES_NB"
echo "> SHORT_CHARS : $SHORT_CHARS_NB"
echo "> TOPICS : $TOPICS"
echo "> COMMENTS_ENABLED : $COMMENTS_ENABLED"
2024-05-27 16:19:52 +02:00
echo
echo "╭───────────────────────────╮"
2024-05-30 15:03:56 +02:00
echo "│ Configuring Oracolo... ⏳ │"
2024-05-27 16:19:52 +02:00
echo "╰───────────────────────────╯"
2024-05-30 15:03:56 +02:00
src_index_html="/usr/share/nginx/html/index.html"
2024-05-27 16:19:52 +02:00
echo
2024-05-30 15:03:56 +02:00
echo -n "> Updating author npub key... "
2024-05-27 16:19:52 +02:00
sed -i "s/replace_with_your_npub/$NPUB/" $src_index_html
echo "✅"
2024-05-30 15:03:56 +02:00
echo -n "> Updating nostr relays... "
2024-05-27 16:19:52 +02:00
old_relays="wss://nos.lol, wss://relay.damus.io, wss://nostr.wine"
RELAYS=$(echo $RELAYS | sed 's/^"//' | sed 's/"$//')
sed -i "s|$old_relays|$RELAYS|g" $src_index_html
echo "✅"
2024-05-30 15:03:56 +02:00
echo -n "> Updating top-notes... "
2024-05-27 16:19:52 +02:00
old_TOP_NOTES='name="top-notes" value="0"'
TOP_NOTES="name=\"top-notes\" value=\"$TOP_NOTES_NB\""
sed -i "s|$old_TOP_NOTES|$TOP_NOTES|g" $src_index_html
echo "✅"
2024-05-30 15:03:56 +02:00
echo -n "> Updating short-chars... "
old_SHORT_CHARS='name="short-chars" value="0"'
SHORT_CHARS="name=\"short-chars\" value=\"$SHORT_CHARS_NB\""
sed -i "s|$old_SHORT_CHARS|$SHORT_CHARS|g" $src_index_html
2024-05-27 16:19:52 +02:00
echo "✅"
2024-06-06 21:56:18 +02:00
echo -n "> Updating topics... "
old_TOPICS='name="topics" value=""'
TOPICS="name=\"topics\" value=\"$TOPICS\""
sed -i "s|$old_TOPICS|$TOPICS|g" $src_index_html
echo "✅"
echo -n "> Updating comments... "
old_COMMENTS='name="comments" value="yes"'
COMMENTS_ENABLED="name=\"comments\" value=\"$COMMENTS_ENABLED\""
sed -i "s|$old_COMMENTS|$COMMENTS_ENABLED|g" $src_index_html
echo "✅"
2024-05-27 16:19:52 +02:00
echo
echo "╭──────────────────────╮"
echo "│ Starting Nginx... 🚀 │"
echo "╰──────────────────────╯"
echo
2024-05-30 15:03:56 +02:00
exec "$@"