ADD: support for mysql config and log database

This commit is contained in:
Dominik Meyer 2024-01-21 13:44:37 +01:00
parent 17415f5efb
commit e200282aab
Signed by: byterazor
GPG Key ID: EABDA0FD5981BC97

View File

@ -28,10 +28,33 @@ else
user => "", user => "",
password => "" password => ""
); );
EOF EOF
`" >> /opt/fhem/configDB.conf; `" >> /opt/fhem/configDB.conf;
elif [ "${CONFIG_DATABASE_ENGINE}" == "mysql" ] then
if [ -z ${CONFIG_DATABASE_USER} ]; then
echo "please provide CONFIG_DATABASE_USER "
exit 255
fi
if [ -z ${CONFIG_DATABASE_USER} ]; then
echo "please provide CONFIG_DATABASE_ "
exit 255
fi
echo "`cat <<EOF
%dbconfig= (
connection => "mysql:dbname=${CONFIG_DATABASE}",
user => "${CONFIG_DATABASE_USER}",
password => "${CONFIG_DATABASE_PASS}"
);
EOF
else
echo "unknown database engine provided in CONFIG_DATABASE_ENGINE"
exit 255
fi fi
fi fi
if [ -n "${USELOGDB}" ]; then if [ -n "${USELOGDB}" ]; then
@ -59,6 +82,28 @@ if [ -n "${USELOGDB}" ]; then
); );
EOF EOF
`" >> /opt/fhem/db.conf; `" >> /opt/fhem/db.conf;
elif [ "${LOG_DATABASE_ENGINE}" == "mysql" ] then
if [ -z ${LOG_DATABASE_USER} ]; then
echo "please provide LOG_DATABASE_USER "
exit 255
fi
if [ -z ${LOG_DATABASE_USER} ]; then
echo "please provide LOG_DATABASE_ "
exit 255
fi
echo "`cat <<EOF
%dbconfig= (
connection => "mysql:dbname=${LOG_DATABASE}",
user => "${LOG_DATABASE_USER}",
password => "${LOG_DATABASE_PASS}"
);
EOF
else
echo "unknown database engine provided in LOG_DATABASE_ENGINE"
exit 255
fi fi
fi fi