#!/bin/sh
BASEDIR=$DIR/..
BASEDIR=$( cd "$BASEDIR" ; pwd -P )
export BASEDIR
export SCRIPTDIR=$BASEDIR/scripts
export ETCDIR=$BASEDIR/etc
export VARDIR=$BASEDIR/var
export PYTHONPATH=$PYTHONPATH:$BASEDIR/lib

. $ETCDIR/proxy
export HIDDEN_SERVICE_PROXY_HOST0
export HIDDEN_SERVICE_PROXY_PORT0
export HIDDEN_SERVICE_PROXY_HOST1
export HIDDEN_SERVICE_PROXY_PORT1
export HIDDEN_SERVICE_PROXY_HOST2
export HIDDEN_SERVICE_PROXY_PORT2
export HIDDEN_SERVICE_PROXY_HOST3
export HIDDEN_SERVICE_PROXY_PORT3
export HIDDEN_SERVICE_PROXY_HOST4
export HIDDEN_SERVICE_PROXY_PORT4
export HIDDEN_SERVICE_PROXY_HOST5
export HIDDEN_SERVICE_PROXY_PORT5
export HIDDEN_SERVICE_PROXY_HOST6
export HIDDEN_SERVICE_PROXY_PORT6
export HIDDEN_SERVICE_PROXY_HOST7
export HIDDEN_SERVICE_PROXY_PORT7
export HIDDEN_SERVICE_PROXY_HOST8
export HIDDEN_SERVICE_PROXY_PORT8
export HIDDEN_SERVICE_PROXY_HOST9
export HIDDEN_SERVICE_PROXY_PORT9

export HIDDEN_SERVICE_PROXY_HOST10
export HIDDEN_SERVICE_PROXY_PORT10
export HIDDEN_SERVICE_PROXY_HOST11
export HIDDEN_SERVICE_PROXY_PORT11
export HIDDEN_SERVICE_PROXY_HOST12
export HIDDEN_SERVICE_PROXY_PORT12
export HIDDEN_SERVICE_PROXY_HOST13
export HIDDEN_SERVICE_PROXY_PORT13
export HIDDEN_SERVICE_PROXY_HOST14
export HIDDEN_SERVICE_PROXY_PORT14
export HIDDEN_SERVICE_PROXY_HOST15
export HIDDEN_SERVICE_PROXY_PORT15
export HIDDEN_SERVICE_PROXY_HOST16
export HIDDEN_SERVICE_PROXY_PORT16
export HIDDEN_SERVICE_PROXY_HOST17
export HIDDEN_SERVICE_PROXY_PORT17
export HIDDEN_SERVICE_PROXY_HOST18
export HIDDEN_SERVICE_PROXY_PORT18
export HIDDEN_SERVICE_PROXY_HOST19
export HIDDEN_SERVICE_PROXY_PORT19

export HIDDEN_SERVICE_PROXY_HOST20
export HIDDEN_SERVICE_PROXY_PORT20
export HIDDEN_SERVICE_PROXY_HOST21
export HIDDEN_SERVICE_PROXY_PORT21
export HIDDEN_SERVICE_PROXY_HOST22
export HIDDEN_SERVICE_PROXY_PORT22
export HIDDEN_SERVICE_PROXY_HOST23
export HIDDEN_SERVICE_PROXY_PORT23
export HIDDEN_SERVICE_PROXY_HOST24
export HIDDEN_SERVICE_PROXY_PORT24
export HIDDEN_SERVICE_PROXY_HOST25
export HIDDEN_SERVICE_PROXY_PORT25
export HIDDEN_SERVICE_PROXY_HOST26
export HIDDEN_SERVICE_PROXY_PORT26
export HIDDEN_SERVICE_PROXY_HOST27
export HIDDEN_SERVICE_PROXY_PORT27
export HIDDEN_SERVICE_PROXY_HOST28
export HIDDEN_SERVICE_PROXY_PORT28
export HIDDEN_SERVICE_PROXY_HOST29
export HIDDEN_SERVICE_PROXY_PORT29

export HIDDEN_SERVICE_PROXY_HOST30
export HIDDEN_SERVICE_PROXY_PORT30
export HIDDEN_SERVICE_PROXY_HOST31
export HIDDEN_SERVICE_PROXY_PORT31
export HIDDEN_SERVICE_PROXY_HOST32
export HIDDEN_SERVICE_PROXY_PORT32
export HIDDEN_SERVICE_PROXY_HOST33
export HIDDEN_SERVICE_PROXY_PORT33
export HIDDEN_SERVICE_PROXY_HOST34
export HIDDEN_SERVICE_PROXY_PORT34
export HIDDEN_SERVICE_PROXY_HOST35
export HIDDEN_SERVICE_PROXY_PORT35
export HIDDEN_SERVICE_PROXY_HOST36
export HIDDEN_SERVICE_PROXY_PORT36
export HIDDEN_SERVICE_PROXY_HOST37
export HIDDEN_SERVICE_PROXY_PORT37
export HIDDEN_SERVICE_PROXY_HOST38
export HIDDEN_SERVICE_PROXY_PORT38
export HIDDEN_SERVICE_PROXY_HOST39
export HIDDEN_SERVICE_PROXY_PORT39

export HIDDEN_SERVICE_PROXY_HOST40
export HIDDEN_SERVICE_PROXY_PORT40
export HIDDEN_SERVICE_PROXY_HOST41
export HIDDEN_SERVICE_PROXY_PORT41
export HIDDEN_SERVICE_PROXY_HOST42
export HIDDEN_SERVICE_PROXY_PORT42
export HIDDEN_SERVICE_PROXY_HOST43
export HIDDEN_SERVICE_PROXY_PORT43
export HIDDEN_SERVICE_PROXY_HOST44
export HIDDEN_SERVICE_PROXY_PORT44
export HIDDEN_SERVICE_PROXY_HOST45
export HIDDEN_SERVICE_PROXY_PORT45
export HIDDEN_SERVICE_PROXY_HOST46
export HIDDEN_SERVICE_PROXY_PORT46
export HIDDEN_SERVICE_PROXY_HOST47
export HIDDEN_SERVICE_PROXY_PORT47
export HIDDEN_SERVICE_PROXY_HOST48
export HIDDEN_SERVICE_PROXY_PORT48
export HIDDEN_SERVICE_PROXY_HOST49
export HIDDEN_SERVICE_PROXY_PORT49

export HIDDEN_SERVICE_PROXY_HOST50
export HIDDEN_SERVICE_PROXY_PORT50
export HIDDEN_SERVICE_PROXY_HOST51
export HIDDEN_SERVICE_PROXY_PORT51
export HIDDEN_SERVICE_PROXY_HOST52
export HIDDEN_SERVICE_PROXY_PORT52
export HIDDEN_SERVICE_PROXY_HOST53
export HIDDEN_SERVICE_PROXY_PORT53
export HIDDEN_SERVICE_PROXY_HOST54
export HIDDEN_SERVICE_PROXY_PORT54
export HIDDEN_SERVICE_PROXY_HOST55
export HIDDEN_SERVICE_PROXY_PORT55
export HIDDEN_SERVICE_PROXY_HOST56
export HIDDEN_SERVICE_PROXY_PORT56
export HIDDEN_SERVICE_PROXY_HOST57
export HIDDEN_SERVICE_PROXY_PORT57
export HIDDEN_SERVICE_PROXY_HOST58
export HIDDEN_SERVICE_PROXY_PORT58
export HIDDEN_SERVICE_PROXY_HOST59
export HIDDEN_SERVICE_PROXY_PORT59


. $ETCDIR/database
export DB_HOST
export DB_USER
export DB_PASS
export DB_BASE

. $ETCDIR/elasticsearch
export ELASTICSEARCH_ENABLED
export ELASTICSEARCH_HOST
export ELASTICSEARCH_PORT
export ELASTICSEARCH_TIMEOUT
export ELASTICSEARCH_USERNAME
export ELASTICSEARCH_PASSWORD

. $ETCDIR/limits
export RESULT_LIMIT
export MAX_RESULT_LIMIT

. $ETCDIR/site
export SITE_PATH
export SITE_DOMAIN

### Check if flask.secret exist ###
if [ -f "$ETCDIR/private/flask.secret" ]; then
    . $ETCDIR/private/flask.secret
    export FLASK_SECRET
fi

. $ETCDIR/memcached
export MEMCACHED_ENABLED
export MEMCACHED_HOST
export MEMCACHED_PORT
