-
Notifications
You must be signed in to change notification settings - Fork 109
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
Loading user credentials from keyring. #65
Conversation
When configuration lacks user credentials application will try fetching data from keyring.
Awesome that you are looking at this, we've been (partially) missing this for quite some time. Did you know that mopidy actually already supports getting config values from the keyring? We've had that for ages, but lost interest so we never added commands to populate the keyring, nor did we document it. |
And looking more closely at you PR I do see you are using our helpers already :-) |
@adamcik |
https://github.com/mopidy/mopidy/blob/develop/mopidy/config/__init__.py#L80 is the line of interest in our existing code. This loads and merges config files, defaults, keyring data and finally any commandline overrides. The intention of this was that extensions should not have to be aware of if the data comes from the keyring or one of the other sources. |
@adamcik |
Probably, as it if we can fix it once and for all in Mopidy it would at least save you having to update the rest of the extensions :-) |
If you want to, you can force-push to the same branch to replace the commits here with another implementation. |
It looks like the only needed change in here is to set username & password to optional in config schema and implement behaviour for these fields not set at all. |
My memory for this part of everything might be a bit rusty, but I think we still want it to be mandatory, as we can't run without login credentials. And if they come from the keyring or the config file should make no difference to the config validation. On the other hand, if the intent is to support the spotify auth blob, then making it optional makes a lot of sense. But then we would "just" need a |
@adamcik |
@robin92 can you explain to me how to set that up? (encrypted) |
@aycgit
and then the following entries in my keyring
What mopidy does is matching This is equivalent to explicitly specifying credentials in the config file:
Please note that only entries with |
Username & password values in configuration are now optional. When configuration lacks user credentials application will try fetching data from keyring.