mirror of
https://github.com/unraid/api.git
synced 2026-02-25 11:19:42 -06:00
feat: npm scripts to prevent webgui builds with wrong urls
This commit is contained in:
17
web/scripts/postbuild-webgui-restore-env.sh
Executable file
17
web/scripts/postbuild-webgui-restore-env.sh
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Set the file paths
|
||||
env_backup=".env.backup"
|
||||
env=".env"
|
||||
|
||||
# Check if backup exists
|
||||
if [ -f "$env_backup" ]; then
|
||||
# Restore contents from backup to .env
|
||||
cp "$env_backup" "$env"
|
||||
echo "Contents restored from $env_backup to $env"
|
||||
# Remove backup
|
||||
rm "$env_backup"
|
||||
echo "Backup file $env_backup removed."
|
||||
else
|
||||
echo "Backup file $env_backup not found. Unable to restore."
|
||||
fi
|
||||
20
web/scripts/prebuild-webgui-set-env.sh
Executable file
20
web/scripts/prebuild-webgui-set-env.sh
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Prevent incorrect vars from being used when building for the webgui
|
||||
|
||||
# Set the file paths
|
||||
env_production=".env.production"
|
||||
env_backup=".env.backup"
|
||||
env=".env"
|
||||
|
||||
# Backup existing .env file
|
||||
if [ -f "$env" ]; then
|
||||
cp "$env" "$env_backup"
|
||||
echo "Backup of $env created at $env_backup"
|
||||
else
|
||||
echo "$env not found. Creating a new one."
|
||||
fi
|
||||
|
||||
# Copy contents from .env.production to .env
|
||||
cp "$env_production" "$env"
|
||||
echo "Contents of $env_production copied to $env"
|
||||
Reference in New Issue
Block a user