aboutsummaryrefslogtreecommitdiff
path: root/entrypoint.sh
diff options
context:
space:
mode:
Diffstat (limited to 'entrypoint.sh')
-rwxr-xr-xentrypoint.sh32
1 files changed, 32 insertions, 0 deletions
diff --git a/entrypoint.sh b/entrypoint.sh
new file mode 100755
index 0000000..7e67c87
--- /dev/null
+++ b/entrypoint.sh
@@ -0,0 +1,32 @@
+#!/bin/sh
+# File: entrypoint.sh
+# Project: newspipe-docker
+# Startdate: 2023-06-15
+
+# For first run:
+test ! -f /newspipe/instance/config.py && { cp -pf /newspipe/orig/config.py /newspipe/instance/ 2>/dev/null ; }
+test ! -f /newspipe/instance/sqlite.py && { cp -pf /newspipe/orig/sqlite.py /newspipe/instance/ 2>/dev/null ; }
+test ! -f /newspipe/instance/newspipe.db && { cp -pf /newspipe/orig/newspipe.db /newspipe/instance/ 2>/dev/null ; }
+test -z "${NEWSPIPE_BRANCH}" && NEWSPIPE_BRANCH=ldap-auth
+
+# Options
+case "${1}" in
+ "init" | "create_admin")
+ _nick="${2:-${ADMIN_NICKNAME}}"
+ _pass="${3:-${ADMIN_PASSWORD}}"
+ poetry run flask create_admin --nickname "${_nick}" --password "${_pass}"
+ ;;
+ *)
+ cd /newspipe
+ git fetch || : ;
+ git checkout "${NEWSPIPE_BRANCH}" || { echo "Invalid branch ${NEWSPIPE_BRANCH}" 1>&2 ; exit 1 ; }
+ git pull || : ;
+ _host="${1:-${NEWSPIPE_HOST}}"
+ _port="${2:-${NEWSPIPE_PORT}}"
+ set -x
+ # If you need to add new pip packages quickly:
+ #poetry run pip3 install dnspython
+ poetry run flask db_init || :
+ poetry run flask run -h "${_host:-0.0.0.0}" -p "${_port:-8081}"
+ ;;
+esac
bgstack15