Skip to content
This repository has been archived by the owner on Dec 9, 2019. It is now read-only.

Commit

Permalink
Fix: Support PRIVATE and ALLOW_NEW_REGISTRATION variables
Browse files Browse the repository at this point in the history
  • Loading branch information
winkidney committed Sep 8, 2018
1 parent 2b07342 commit fd8fdeb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
20 changes: 15 additions & 5 deletions bootstrap.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#!/bin/bash

# Force users to login before seeing any pins.
if [ "$ALLOW_NEW_REGISTRATIONS" == "" ]; then
ALLOW_NEW_REGISTRATIONS=true
fi


sudo docker images |grep pinry || echo "No docker image found, building..." || ./build_docker.sh

echo "=================================================================================="
Expand All @@ -18,14 +24,18 @@ echo ""
echo ${SECRET_KEY}
echo "=================================================================================="

if [ ! -f ./pinry/local_settings.py ]
if [ ! -f ./pinry/local_settings.py ];
then
cp ./pinry/local_settings.example.py ./pinry/local_settings.py
sed -i "s/secret\_key\_place\_holder/${SECRET_KEY}/" ./pinry/local_settings.py
fi

if [ ! -f ./pinry/local_settings.py ]
then
cp ./pinry/local_settings.example.py ./pinry/local_settings.py
sed -i "s/secret\_key\_place\_holder/${SECRET_KEY}/" ./pinry/local_settings.py
# Force users to login before seeing any pins.
if [ -n "$PRIVATE" ]; then
sed -i "s/PUBLIC = True/PUBLIC = False/" ./pinry/local_settings.py
fi

# Enable people from creating new accounts.
if [ -n "$ALLOW_NEW_REGISTRATIONS" ]; then
sed -i "s/ALLOW_NEW_REGISTRATIONS = False/ALLOW_NEW_REGISTRATIONS = True/" ./pinry/local_settings.py
fi
2 changes: 1 addition & 1 deletion pinry/local_settings.example.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
}

# Allow users to register by themselves
ALLOW_NEW_REGISTRATIONS = True
ALLOW_NEW_REGISTRATIONS = False

# Delete image files once you remove your pin
IMAGE_AUTO_DELETE = True
Expand Down

0 comments on commit fd8fdeb

Please sign in to comment.