Skip to content
This repository has been archived by the owner on Jun 30, 2024. It is now read-only.

Commit

Permalink
ENH: if /srv/config/{instructors,students}.csv provided - DB is popul…
Browse files Browse the repository at this point in the history
…ated and locked down avoid sign ups
  • Loading branch information
yarikoptic committed Jan 4, 2019
1 parent 403e891 commit 6a65bfb
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,24 @@ if [ ! -e "$stamp" ]; then
# Let's use https
# Wouldn't "just work" magically. Requires certificates etc. Eventually!
# echo -e '\nsettings.server_type = "https://"' >> $WEB2PY_PATH/applications/runestone/models/0.py

# Setup students
if [ -e '/srv/configs/instructors.csv' ]; then
info "Setting up instructors"
su -c "rsmanage inituser --fromfile /srv/configs/instructors.csv" runestone
cut -d, -f1,6 /srv/configs/instructors.csv \
| tr ',' ' ' \
| while read n c ; do
su -c "rsmanage addinstructor --username $n --course $c" runestone;
done
fi
if [ -e '/srv/configs/students.csv' ]; then
info "Setting up students"
su -c "rsmanage inituser --fromfile /srv/configs/students.csv" runestone
info "Students were provided -- disabling signup!"
# Disable signup
echo -e "\nauth.settings.actions_disabled.append('register')" >> $WEB2PY_PATH/applications/runestone/models/db.py
fi
touch "$stamp"
else
info "Already initialized"
Expand All @@ -45,6 +63,9 @@ cd "${BOOKS_PATH}"
);
done

# for debugging
# su -c 'bash' runestone

# Run the beast
info "Starting the server"
cd "$WEB2PY_PATH"
Expand Down

0 comments on commit 6a65bfb

Please sign in to comment.