Does anyone know how to utilize the secrets.yaml file when using a mysql database with the recorder?
I see no way to add the ‘!secret’ into the connection db_url.
Thanks.
Does anyone know how to utilize the secrets.yaml file when using a mysql database with the recorder?
I see no way to add the ‘!secret’ into the connection db_url.
Thanks.
Try this
configuration.yaml
recorder:
purge_days: 365
db_url: !secret recorder_db_url
secrets.yaml
recorder_db_url: mysql://hassuser:PASSWORD@IPADDRESS/hass_db
Great work, that did the trick thanks.
So I have the mariadb add-on running properly in my hassos setup, and I am using the above method to put the url in my secrets.yaml. However there is still one secret item not stored in the secrets file… the password in the mariadb config itself. I have tried modifying it with a !secret, but it appears the mariadb add-on config does not work with !secret because the only valid config is something surrounded in “”.
For example, this will work (of course):
"password": "mysecretpassword"
But if one tries adding to secrets.yaml:
mariadb_password: mysecretpassword
…together with this does not work (connection fails):
"password": "!secret mariadb_password"
…and neither does (config fails inspection):
"password": !secret mariadb_password
A similar variation, putting quotes inside the secrets.yaml line does not work either. Has anyone else got their mariadb password configured as a secret using the add-on config, or is this just not possible using the add-on?
Thanks,
Kevin
Did you ever figure this out? Thanks!
Actually, this format works:
databases:
- homeassistant
logins:
- username: '!secret mariadb_user'
password: '!secret mariadb_password'
rights:
- username: '!secret mariadb_user'
database: homeassistant
So for the url, there is no way to solely take password and/or username from secrets.yaml
, right?
Comparable to:
configuration.yaml
recorder:
db_url: "mysql://{{ !secret db_user }}:{{ !secret db_password }}@server.tld/dbname?charset=utf8mb4"
secrets.yaml
db_user: myusername
db_password: mysecretpassword
This would be super cool
Hi, anyone figured out how to put the user and password for MariaDB in the secrets.yaml file
up!
unburrying question