addon-vscode-remote/vscode-remote/rootfs/etc/cont-init.d/mysql.sh
2020-07-29 01:04:45 +02:00

25 lines
800 B
Bash

#!/usr/bin/with-contenv bashio
# ==============================================================================
# Home Assistant Community Add-on: VSCode Remote
# Pre-configures the MySQL clients, if the service is available
# ==============================================================================
declare host
declare password
declare port
declare username
if bashio::services.available "mysql"; then
host=$(bashio::services "mysql" "host")
password=$(bashio::services "mysql" "password")
port=$(bashio::services "mysql" "port")
username=$(bashio::services "mysql" "username")
mkdir -p /root/.config
{
echo "[client]"
echo "host=${host}"
echo "password=\"${password}\""
echo "port=${port}"
echo "user=\"${username}\""
} > /etc/mysql/conf.d/service.cnf
fi