diff --git a/docs/configuration.rst b/docs/configuration.rst index 2aa6416..abd4cab 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -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". \ No newline at end of file diff --git a/docs/module.rst b/docs/module.rst index 6b195f3..31be7be 100644 --- a/docs/module.rst +++ b/docs/module.rst @@ -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. diff --git a/i3pystatus/core/settings.py b/i3pystatus/core/settings.py index ff8104a..aa78c45 100644 --- a/i3pystatus/core/settings.py +++ b/i3pystatus/core/settings.py @@ -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())