Add CI/CD build and deploy scripts, along with docker-compose, HAProxy config, and a certbot
Some checks failed
Build And Deploy / build-and-deploy (push) Has been cancelled

merge hook. Set up env.example generation. Add doiuse dev dependency.
This commit is contained in:
badblocks 2026-02-01 13:14:32 -08:00
parent 0350a4b8e3
commit 1714225d00
No known key found for this signature in database
11 changed files with 334 additions and 2 deletions

47
utils/generate-env-example.sh Executable file
View file

@ -0,0 +1,47 @@
#!/bin/bash
cd $(dirname $(dirname $(realpath $0)))
# Path to the original .env file
ENV_FILE=".env"
# Path to the new .env.example file
EXAMPLE_FILE=".env.example"
# Check if the .env file exists
if [ ! -f "$ENV_FILE" ]; then
echo "The file $ENV_FILE does not exist."
exit 1
fi
# Create or empty the .env.example file
> "$EXAMPLE_FILE"
SKIP_NEXT=false
# Read each line in .env
while IFS= read -r line; do
# Skip the current line if the previous line is part of a multiline/quoted string
if [[ $SKIP_NEXT == true ]]; then
if [[ $line == *'"'* ]]; then
SKIP_NEXT=false
fi
continue
# Copy comments and empty lines verbatim
elif [[ $line == \#* ]] || [[ -z $line ]]; then
echo "$line" >> "$EXAMPLE_FILE"
continue
# Check if the line is a multiline/quoted string
elif [[ $line == *'="'* ]]; then
if [[ $line != *'"' ]]; then
SKIP_NEXT=true
fi
LINE=${line%%=*}
echo "$LINE=\"\${$LINE}\"" >> "$EXAMPLE_FILE"
# For all other lines, copy only the key (everything before the '=') if present
elif [[ $line == *'='* ]]; then
LINE=${line%%=*}
echo "$LINE=\${$LINE}" >> "$EXAMPLE_FILE"
fi
done < "$ENV_FILE"
echo ".env.example file created successfully."