Skip to content

Commit

Permalink
#12 Enable manual override for Git clone URL
Browse files Browse the repository at this point in the history
  • Loading branch information
Jafner committed Jan 9, 2024
1 parent af23b71 commit 1d58294
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 4 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ services:
# GET5ETOOLS-NOIMG pulls from https://get.5e.tools without image files.
# The get.5e.tools source has been down (redirecting to 5e.tools) during development.
# This method is not tested.
#- GIT_URL=https://github.com/5etools-mirror-1/5etools-mirror-1.github.io.git
# Use this to override the default "official" mirror link. Only works for initial Git clone.
# Does not work when an existing repository is present.
# Defaults to https://github.com/5etools-mirror-2/5etools-mirror-2.github.io.git
#- OFFLINE_MODE=TRUE
# Optional. Expects "TRUE" or "FALSE".

Expand Down
8 changes: 2 additions & 6 deletions init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,19 @@ SOURCE=${SOURCE}
echo "SOURCE=$SOURCE"
case $SOURCE in
GITHUB | GITHUB-NOIMG) # Source is the github mirror
DL_LINK=https://github.com/5etools-mirror-2/5etools-mirror-2.github.io.git
DL_LINK=${GIT_URL:-https://github.com/5etools-mirror-2/5etools-mirror-2.github.io.git}
echo " === Using GitHub mirror at $DL_LINK"
if [ ! -d "./.git" ]; then # if no git repository already exists
echo " === No existing git repository, creating one"
git config --global user.email "autodeploy@localhost"
git config --global user.name "AutoDeploy"
git config --global pull.rebase false # Squelch nag message
git config --global http.postBuffer 524288000 # Fix buffer issue on Git Bash
git config --global https.postBuffer 524288000 # Fix buffer issue on Git Bash
git config --global --add safe.directory '/usr/local/apache2/htdocs' # Disable directory ownership checking, required for mounted volumes
git clone --filter=blob:none --no-checkout $DL_LINK . # clone the repo with no files and no object history
git config core.sparseCheckout true # enable sparse checkout
git sparse-checkout init
else
echo " === Using existing git repository"
git config --global http.postBuffer 524288000 # Fix buffer issue on Git Bash
git config --global https.postBuffer 524288000 # Fix buffer issue on Git Bash
git config --global --add safe.directory '/usr/local/apache2/htdocs' # Disable directory ownership checking, required for mounted volumes
fi
if [[ "$SOURCE" == *"NOIMG"* ]]; then # if user does not want images
Expand All @@ -68,7 +64,7 @@ case $SOURCE in
fi
git checkout
git fetch
git pull
git pull --depth=1
VERSION=$(jq -r .version package.json) # Get version from package.json
if [[ `git status --porcelain` ]]; then
git restore .
Expand Down

0 comments on commit 1d58294

Please sign in to comment.