#!/bin/bash ThisScriptConfigured=no ##Linkwarden LinkwardenURL=http://localhost:3000 ##DB PostgresqlIP=127.0.0.1 PostgresqlPort=5432 PostgresqlUsername=linkwarden PostgresqlDatabase=linkwarden PostgresqlPassword= #Check if script is configured if [ $ThisScriptConfigured = no ]; then echo "Script is not configured" exit fi ##Update config sed -i "s#^DATABASE_URL=#DATABASE_URL=postgresql://$PostgresqlUsername:$PostgresqlPassword@$PostgresqlIP:$PostgresqlPort/$PostgresqlDatabase#" /opt/node/linkwarden/.env sed -i "s/NEXTAUTH_SECRET=/NEXTAUTH_SECRET=$(dd bs=32 count=1 if=/dev/urandom | base64 | tr +/ _.)/" /opt/node/linkwarden/.env sed -i "s#http://localhost:3000#$LinkwardenURL#" /opt/node/linkwarden/.env #Save PM2 statup config sudo -u node bash << EOF (cd /opt/node/linkwarden; yarn prisma:deploy) pm2 install pm2-logrotate pm2 start yarn --name Linkwarden --cwd /opt/node/linkwarden -- concurrently:start pm2 save EOF