summaryrefslogtreecommitdiffstats
path: root/roles/hubs/templates/bashrc
blob: 89027290a48e0923402f514df990adfbc6b89770 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
    . /etc/bashrc
fi

# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=

# User specific aliases and functions
# If adding new functions to this file, note that you can add help text to the function
# by defining a variable with name _<function>_help containing the help text


export HUBS_CONFIG={{ hubs_conf_dir }}/hubs_config.py
export FLASK_APP={{ hubs_code_dir }}/hubs/app.py


workon() {
    [ "$1" == "hubs" ] || ( echo "No such virtualenv."; exit 1 )
    source {{ hubs_venv_dir }}/bin/activate
    cd {{ hubs_code_dir }}
}

hup() {
    source {{ hubs_venv_dir }}/bin/activate
    pushd {{ hubs_code_dir }}
    FLASK_DEBUG=1 flask run --host 0.0.0.0 --port 5000
}

hreset() {
    source {{ hubs_venv_dir }}/bin/activate
    {% if hubs_db_type == "postgresql" %}
    sudo -u postgres dropdb hubs
    sudo -u postgres createdb -O hubs hubs
    {% else %}
    rm {{ hubs_var_dir }}/hubs.db
    {% endif %}
    rm {{ hubs_var_dir }}/cache.db
    pushd {{ hubs_code_dir }}
    python populate.py
    popd
    deactivate
}