-
-
Notifications
You must be signed in to change notification settings - Fork 31.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Split secrets from configuration files #2262
Conversation
How does it work with lists? |
It will iterate over all items in lists. and handle all OrderedDicts in the lists |
Added some tests, but will have to add the array index to new_path to truly separate items in lists |
from homeassistant.exceptions import HomeAssistantError | ||
from homeassistant.const import EVENT_HOMEASSISTANT_START | ||
try: | ||
import keyring # pylint: disable=wrong-import-order,wrong-import-position |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's with the pylint disables ? The imports are ordered built-in, 3rd party, home assistant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pylint complained about the try catch around the import if it is before the home assistant imports. Not sure if there's a better way to do it?
And keyring should probably be optional
I see an issue with lists. It is very common for people to have a list of platforms that contain duplicate platform types and that could totally be unrelated usernames/passwords. That would not work right now as the path to it would be the same. And that brings me to the next issue: I think that this is getting way too complex. The goal is to be able to extract sensitive information from the main config and optionally offer an extra way of encrypting this in a keyring. I think that instead of doing like this, we should go way simpler. Instead of auto-generating namespaced names, let's just allow the user to do it. Base it on the existing nest:
username: !yaml_var nest_username
password: !yaml_var nest_password I want to try to avoid as much magic as possible when it comes to the config because it is already confusing as is. If we start doing things like auto-resolving password fields if we find username the user will not know how to even start debugging if a problem occurs. |
Ok, that is a good idea, will simplify things a bit Do you prefer Or |
For secret, let's use |
|
Description:
Option to split secrets from configuration files. Secrets can be stored in (one or both):
secrets.yaml
(in same folder as configuration.yaml)This uses the loaded
configuration.yaml
and inserts secrets where applicable:configuration.yaml
. So the user can choose to remove secrets (if at all).(-)
in the value will resolve the secret.username
is present, and nopassword
the password will be resolved. The username can also contain a(-)
password
present it will be left as is. Or resolved if it contains(-)
secrets.yaml
raises a warning--passwords
?Related issue (if applicable): fixes #
Pull request in home-assistant.io with documentation (if applicable): home-assistant/home-assistant.io#
Example entry for
configuration.yaml
:resolves to:
using
secrets.yaml
file:Checklist:
If user exposed functionality or configuration variables are added/changed:
If the code does not interact with devices:
tox
run successfully. Your PR cannot be merged unless tests pass