Add script to add LAN IP to Nextcloud config

This commit is contained in:
Christopher
2023-12-29 19:59:23 -06:00
parent 3c729c878b
commit aa3873e35d
2 changed files with 25 additions and 0 deletions

View File

@@ -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)"
```

View File

@@ -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"