Added documentation of keyring feature.

This commit is contained in:
facetoe 2015-02-14 10:32:32 +08:00
parent 61a8669eca
commit c051e01959
3 changed files with 17 additions and 0 deletions

View File

@ -122,3 +122,13 @@ Also change your i3wm config to the following:
position top
workspace_buttons yes
}
Settings that require credentials can utilize the keyring module to keep sensitive information out of config files.
To take advantage of this feature, simply use the setting_util.py script to set the credentials for a module. Once this
is done you can add the module to your config without specifying the credentials, eg:
::
status.register('github')
i3pystatus will locate and set the credentials during the module loading process. Currently supported credentals are "password", "email" and "username".

View File

@ -14,6 +14,9 @@ tools for this which make this even easier:
periodically.
- Settings (already built into above classes) allow you to easily
specify user-modifiable attributes of your class for configuration.
- For modules that require credentials, it is recommended to add a
keyring_backend setting to allow users to specify their own backends
for retrieving sensitive credentials.
Required settings and default values are also handled.

View File

@ -93,6 +93,10 @@ class SettingsBase:
return found_settings
def get_protected_setting(self, setting_name):
"""
Retrieves a protected setting from keyring
:param setting_name: setting_name must be in the format package.module.Class.setting
"""
# If a custom keyring backend has been defined, use it.
if hasattr(self, 'keyring_backend') and self.keyring_backend:
return self.keyring_backend.get_password(setting_name, getpass.getuser())