mirror of
https://github.com/unraid/api.git
synced 2026-01-03 15:09:48 -06:00
This commit updates the default file paths in the prebuild-webgui-set-env.sh script to use the requested env file instead of always using .env.production. If a specific env file is provided as an argument, its contents will be copied to .env. If the requested env file is not found, an error message will be displayed.
26 lines
595 B
Bash
Executable File
26 lines
595 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# Prevent incorrect vars from being used when building for the webgui
|
|
|
|
# Set the default file paths
|
|
env_requested="${1:-.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_requested to .env
|
|
if [ -f "$env_requested" ]; then
|
|
cp "$env_requested" "$env"
|
|
echo "Contents of $env_requested copied to $env"
|
|
else
|
|
echo "Error: $env_requested not found."
|
|
exit 1
|
|
fi
|