mirror of
https://github.com/hassio-addons/addon-vscode.git
synced 2025-05-03 18:51:23 +00:00
✨ Add hook up with the MySQL service
This commit is contained in:
parent
e7bb759397
commit
43a10f5f35
3 changed files with 29 additions and 1 deletions
27
vscode/rootfs/etc/cont-init.d/mysql.sh
Normal file
27
vscode/rootfs/etc/cont-init.d/mysql.sh
Normal file
|
@ -0,0 +1,27 @@
|
|||
#!/usr/bin/with-contenv bashio
|
||||
# ==============================================================================
|
||||
# Home Assistant Community Add-on: Visual Studio Code
|
||||
# Pre-configures the MySQL clients, if the service is available
|
||||
# ==============================================================================
|
||||
declare host
|
||||
declare password
|
||||
declare port
|
||||
declare username
|
||||
|
||||
host=$(bashio::services "mysql" "host")
|
||||
if bashio::var.has_value "${host}"; then
|
||||
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
|
||||
else
|
||||
bashio::log.info "The above error can be ignored if you don't have MariaDB installed"
|
||||
fi
|
Loading…
Add table
Add a link
Reference in a new issue