|
|
@@ -1,22 +1,30 @@
|
|
|
#!/bin/bash
|
|
|
-#
|
|
|
|
|
|
-set -e # Exit immediately if any command exits with a non-zero status
|
|
|
+CONFIG_FILE="instance/config.py"
|
|
|
|
|
|
-activate_venv() {
|
|
|
- source env/bin/activate
|
|
|
-}
|
|
|
+NEW_VARIABLES="\
|
|
|
+INDIEAUTH_CLIENT_ID = '' # Create a new access token at Owncast Admin panel -> Integrations -> Access Tokens, this variable is the name you associate with that token
|
|
|
+INDIEAUTH_CLIENT_SECRET = '' # The access token you created for INDIEAUTH_CLIENT_ID
|
|
|
+"
|
|
|
|
|
|
-update_db() { # Create the database. This also populates it with some goals and votes from the default rewards.py
|
|
|
- export FLASK_APP=ownchatbot
|
|
|
- if python -m flask update-db; then
|
|
|
- echo "Database updated successfully."
|
|
|
- else
|
|
|
- echo "Failed to update the database. Please check for errors."
|
|
|
- exit 1 # Exit the script with a non-zero status
|
|
|
+# Create a temporary file
|
|
|
+TEMP_FILE=$(mktemp)
|
|
|
+
|
|
|
+# Read through the original config file and output to the temp file
|
|
|
+while IFS= read -r line
|
|
|
+do
|
|
|
+ echo "$line" >> "$TEMP_FILE"
|
|
|
+
|
|
|
+ # Check for the section marker and insert new lines after it
|
|
|
+ if [[ "$line" == "# Owncast stuff. Needed to interact with your Owncast instance" ]]; then
|
|
|
+ echo "$NEW_VARIABLES" >> "$TEMP_FILE"
|
|
|
fi
|
|
|
-}
|
|
|
+done < "$CONFIG_FILE"
|
|
|
+
|
|
|
+# Replace the original config file with the updated temp file
|
|
|
+mv "$TEMP_FILE" "$CONFIG_FILE"
|
|
|
+
|
|
|
+echo "Config file updated."
|
|
|
+echo "Create a new access token in your Owncast Admin panel -> Integrations -> Access Tokens."
|
|
|
+echo "Enter the new name and token into the new variables in $CONFIG_FILE."
|
|
|
|
|
|
-activate_venv
|
|
|
-update_db
|
|
|
-deactivate
|