feat: npm scripts to prevent webgui builds with wrong urls

This commit is contained in:
Zack Spear
2024-01-08 11:13:22 -06:00
parent dea66ff49d
commit 63b7c0361e
3 changed files with 42 additions and 3 deletions

View 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

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