#/bin/bash

# Set port
if [ "x$BASE_PORT" == "x" ]; then
    BASE_PORT=8888
    echo "[INFO] using default Notebook server port (8888)"
else
    echo "[INFO] Setting Notebook server port to $BASE_PORT" 
fi

# Set password
if [ "x$AUTH_PASS" == "x" ]; then
    echo "[INFO] Not using anyNotebook server password" 
else
    echo "[INFO] Setting Notebook server password to $AUTH_PASS" 
fi

# Create Notebooks dir if not existent
mkdir -p /home/metauser/notebooks

# Run the Jupyter Notebook server. Use --allow-root if need to run as root. 
exec jupyter notebook --ip=0.0.0.0 --port=$BASE_PORT --no-browser --NotebookApp.token=$AUTH_PASS --NotebookApp.notebook_dir='/home/metauser/notebooks'
