aboutsummaryrefslogtreecommitdiff
path: root/docker/scripts/pre/20_ejabberd_config.sh
blob: 498648c5acf801ccee948f7209b8c1fe6ddad260 (plain) (blame)
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
#!/bin/bash
set -e

source "${EJABBERD_HOME}/scripts/lib/base_config.sh"
source "${EJABBERD_HOME}/scripts/lib/config.sh"
source "${EJABBERD_HOME}/scripts/lib/base_functions.sh"
source "${EJABBERD_HOME}/scripts/lib/functions.sh"


make_config() {
    if [ ! -e ${CONFIGFILE} ]; then
        echo "Generating ejabberd config file..."
        cat ${CONFIGTEMPLATE} \
          | python -c "${PYTHON_JINJA2}" \
          > ${CONFIGFILE}
    else
        echo "ejabberd config file exists."
    fi

    if [ ! -e ${CTLCONFIGFILE} ]; then
        echo "Generating ejabberdctl config file..."
        cat ${CTLCONFIGTEMPLATE} \
          | python -c "${PYTHON_JINJA2}" \
          > ${CTLCONFIGFILE}
    else
        echo "ejabberdctl config file exists."
    fi
}


file_exist ${FIRST_START_DONE_FILE} \
    && exit 0


# generate config file
make_config

exit 0