summaryrefslogtreecommitdiffstats
path: root/snap-src/bin/wekan-control
blob: bc2cefded255dd79d1f42dcd401e3859d169572f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash

# get wekan/mongo settings
source $SNAP/bin/wekan-read-settings

export NODE_PATH=$SNAP/bin
# if possible we prefer to bind over unix socket
if [ "nill" != "$MONGODB_BIND_UNIX_SOCKET" ] && [ "x" != "x$MONGODB_BIND_UNIX_SOCKET" ]; then
    if [ -d $MONGODB_BIND_UNIX_SOCKET ]; then
        export MONGO_URL="mongodb://$MONGODB_BIND_UNIX_SOCKET/mongodb-${MONGODB_PORT}.sock/wekan"
    else
        export MONGO_URL="mongodb://$SNAP_DATA/shared/$MONGODB_BIND_UNIX_SOCKET/wekan"
    fi
else
    [ "x" == "x$MONGODB_BIND_IP" ] && MONGODB_BIND_IP="127.0.0.1"
    export MONGO_URL="mongodb://$MONGODB_BIND_IP:$MONGODB_PORT/wekan"
fi

echo -e "MONGO_URL=$MONGO_URL"
APPLICATION_DIRECTORY=$SNAP
APPLICATION_START=main.js
cd $APPLICATION_DIRECTORY
$NODE_PATH/node $APPLICATION_START