~hristoast/mousikofidi

ref: c0b57cb50588058596dadf479acf752356bb5872 mousikofidi/example/mousikofidi -rwxr-xr-x 1.1 KiB
c0b57cb5Hristos N. Triantafillou Add a script to the setuptools installer 1 year, 9 months ago
                                                                                
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
#!/bin/sh

arg="${1}"

if [ "${arg}" = "--help" ] || [ "${arg}" = "-h" ]; then
    cat <<EOF
usage: mousikofidi [-h] [-d] [any flask or uWSGI options]

Run MousikóFídi via Flask or uWSGI.

optional arguments:
  -h, --help            show this help message and exit

Options:
  -d, --dev             Run MousikóFídi via the Flask dev server.  Not
                        recommended for production.

Aside from the above, any other options passed will be provided to
'flask' or 'uwsgi', consult their documentation for more information
about what's available.
EOF
    exit 1
fi

if [ "${arg}" = "--dev" ] || [ "${arg}" = "-d" ]; then
    if [ -f $(which uwsgi >/dev/null 2>/dev/null) ]; then
        FLASK_APP=mousikofidi FLASK_ENV=development flask run
    else
        echo "ERROR: The `flask` executable could not be found!  Exiting..."
        exit 1
    fi
fi

if ! [ -f $(which uwsgi >/dev/null 2>/dev/null) ]; then
    echo "ERROR: The `uwsgi` executable could not be found!  Exiting..."
    exit 1
fi

if [ -f ~/.config/fidi/uwsgi.ini ]; then
    uwsgi --ini ~/.config/fidi/uwsgi.ini "${@}"
else
    uwsgi "${@}"
fi