Skip to content

General Setup

schokotets edited this page Dec 10, 2018 · 2 revisions

Necessary setup info is written down on this page.

You should have a mongodb set-up:
database: roboticsfunding-log
collection: sells
username: webapp
password: roboticsrulez

When you're working on the git project, you may have a different server url. You can prevent your changes to the serverurl variable in load.js from getting into commits by adding the following pre-commit script: courtesy to this stackoverflow post

#!/bin/bash

# this hook looks for lines with the text `let serverurl = ` in the file `load.js` and it resets these lines to the previous state before staged with `reset -p`

if [[ $(git diff --no-ext-diff --cached load.js | grep --count -e "let\ serverurl[\ ]*=[\ ]*") -ne 0 ]]; then
    cat <<EOW
You're attempting to commit changes which you shouldn't, resetting them now
EOW
    echo /$'\n'let\ serverurl$'\n'y$'\n'q | git reset -p &>/dev/null
    # BONUS: Check if after reseting, there is no actual changes to be commited and if so, exit 1 so the commit process will abort.
    if [[ $(git diff --no-ext-diff --cached | wc -l) -eq 0 ]]; then
        echo Commit is cancelled: No other changes
        exit 1
    fi
fi
Clone this wiki locally