ADD: using a configDB and logDB is mandatory now

This commit is contained in:
Dominik Meyer 2024-01-21 22:52:45 +01:00
parent ad60fc3490
commit 95dda4d843
Signed by: byterazor
GPG Key ID: EABDA0FD5981BC97

View File

@ -1,11 +1,5 @@
#!/bin/bash #!/bin/bash
if [ -z ${USECONFIGDB} ]; then
CFG=/opt/fhem/fhem.cfg
else
CFG=configDB
if [ -z ${CONFIG_DATABASE_ENGINE} ]; then if [ -z ${CONFIG_DATABASE_ENGINE} ]; then
CONFIG_DATABASE_ENGINE=sqlite CONFIG_DATABASE_ENGINE=sqlite
@ -30,15 +24,15 @@ else
); );
EOF EOF
`" >> /opt/fhem/configDB.conf; `" >> /opt/fhem/configDB.conf;
elif [ "${CONFIG_DATABASE_ENGINE}" == "mysql" ] then elif [ "${CONFIG_DATABASE_ENGINE}" == "mysql" ]; then
if [ -z ${CONFIG_DATABASE_USER} ]; then if [ -z ${CONFIG_DATABASE_USER} ]; then
echo "please provide CONFIG_DATABASE_USER " echo "please provide CONFIG_DATABASE_USER "
exit 255 exit 255
fi fi
if [ -z ${CONFIG_DATABASE_USER} ]; then if [ -z ${CONFIG_DATABASE_PASS} ]; then
echo "please provide CONFIG_DATABASE_ " echo "please provide CONFIG_DATABASE_PASS"
exit 255 exit 255
fi fi
@ -49,16 +43,12 @@ else
password => "${CONFIG_DATABASE_PASS}" password => "${CONFIG_DATABASE_PASS}"
); );
EOF EOF
`" >> /opt/fhem/configDB.conf;
else else
echo "unknown database engine provided in CONFIG_DATABASE_ENGINE" echo "unknown database engine provided in CONFIG_DATABASE_ENGINE"
exit 255 exit 255
fi fi
fi
if [ -n "${USELOGDB}" ]; then
if [ -z ${LOG_DATABASE_ENGINE} ]; then if [ -z ${LOG_DATABASE_ENGINE} ]; then
LOG_DATABASE_ENGINE=sqlite LOG_DATABASE_ENGINE=sqlite
@ -69,6 +59,7 @@ if [ -n "${USELOGDB}" ]; then
fi fi
if [ -z ${LOG_DATABASE} ]; then if [ -z ${LOG_DATABASE} ]; then
echo "please provide LOG_DATABASE name"
exit 255 exit 255
fi fi
@ -89,8 +80,8 @@ if [ -n "${USELOGDB}" ]; then
exit 255 exit 255
fi fi
if [ -z ${LOG_DATABASE_USER} ]; then if [ -z ${LOG_DATABASE_PASS} ]; then
echo "please provide LOG_DATABASE_ " echo "please provide LOG_DATABASE_PASS "
exit 255 exit 255
fi fi
@ -101,13 +92,13 @@ if [ -n "${USELOGDB}" ]; then
password => "${LOG_DATABASE_PASS}" password => "${LOG_DATABASE_PASS}"
); );
EOF EOF
`" >> /opt/fhem/db.conf;
else else
echo "unknown database engine provided in LOG_DATABASE_ENGINE" echo "unknown database engine provided in LOG_DATABASE_ENGINE"
exit 255 exit 255
fi fi
fi
export FHEM_GLOBALATTR="nofork=1 updateInBackground=1 logfile=/dev/stdout" export FHEM_GLOBALATTR="nofork=1 updateInBackground=1 logfile=/dev/stdout"
cd /opt/fhem || exit 255 cd /opt/fhem || exit 255
./fhem.pl ${CFG} ./fhem.pl confgDB