diff --git a/casaos-add-lan-ip-to-nextcloud-config/README.md b/casaos-add-lan-ip-to-nextcloud-config/README.md new file mode 100644 index 0000000..949a40d --- /dev/null +++ b/casaos-add-lan-ip-to-nextcloud-config/README.md @@ -0,0 +1,9 @@ +# About + +This script adds your LAN IP to the nextcloud config.php. + +# Run command + +```bash +bash -c "$(wget -qLO - https://raw.githubusercontent.com/bigbeartechworld/big-bear-scripts/master/casaos-add-lan-ip-to-nextcloud-config/run.sh)" +``` diff --git a/casaos-add-lan-ip-to-nextcloud-config/run.sh b/casaos-add-lan-ip-to-nextcloud-config/run.sh new file mode 100644 index 0000000..00af058 --- /dev/null +++ b/casaos-add-lan-ip-to-nextcloud-config/run.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +# Get the LAN IP address +lan_ip=$(hostname -I | awk '{print $1}') + +# Backup the original config.php file +cp /DATA/AppData/big-bear-nextcloud/html/config/config.php /DATA/AppData/big-bear-nextcloud/html/config/config.php.bak + +# Add the LAN IP to the config.php file +awk -v ip="$lan_ip" '/0 => '\''localhost'\''/{print; print " 1 => '\''"ip"'\'',"; next}1' /DATA/AppData/big-bear-nextcloud/html/config/config.php.bak > /DATA/AppData/big-bear-nextcloud/html/config/config.php + +# Get the path to the docker-compose.yml file +COMPOSE_FILE="/var/lib/casaos/apps/big-bear-nextcloud/docker-compose.yml" + +# Apply changes using casaos-cli +casaos-cli app-management apply "big-bear-nextcloud" --file="$COMPOSE_FILE"