changed the way to manage SOGo configuration defined by environment variables

This commit is contained in:
Tophe 2021-02-27 16:49:59 +01:00
parent 66206657e6
commit 68bdec479d
3 changed files with 8 additions and 3 deletions

6
script/common.sh Normal file → Executable file
View file

@ -22,5 +22,7 @@ check_require() {
update_conf(){
log_info "setting value for $1"
defaults write sogod "$1" "$2"
}
sed -i '$d' /etc/sogo/sogo.conf
echo " $1 = $2;" >> /etc/sogo/sogo.conf
echo "}" >> /etc/sogo/sogo.conf
}

0
script/mysql.sh Normal file → Executable file
View file

5
script/start.sh Normal file → Executable file
View file

@ -4,6 +4,9 @@ source /usr/local/bin/common.sh
WORKERS_COUNT=${WORKERS_COUNT:-5}
# reset config
echo -en '{\n}' > /etc/sogo/sogo.conf
for conf in $(printenv| grep -i SOGO_ | cut -d= -f1);do
update_conf "${conf:5}" "${!conf}"
done
@ -15,4 +18,4 @@ if [[ -n ${MYSQL_SERVER//[[:blank:]]/} ]]; then
fi
log_info "Launching SOGo"
/usr/sbin/sogod -WOWorkersCount ${WORKERS_COUNT} -WONoDetach YES -WOPort 20000 -WOLogFile - -WOPidFile /tmp/sogo.pid
su -l sogo -s /bin/bash -c "/usr/sbin/sogod -WOWorkersCount ${WORKERS_COUNT} -WONoDetach YES -WOPort 20000 -WOLogFile - -WOPidFile /tmp/sogo.pid"