From 7fe07cce70453c8f8c0df8bf693575fd9abec743 Mon Sep 17 00:00:00 2001 From: Unrud Date: Sat, 15 Jul 2017 09:37:09 +0200 Subject: [PATCH] Example: Custom configuration options for plugins (fixes #658) --- plugins.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/plugins.md b/plugins.md index 1da26cab..424de543 100644 --- a/plugins.md +++ b/plugins.md @@ -37,6 +37,13 @@ from radicale.auth import BaseAuth class Auth(BaseAuth): def is_authenticated(self, user, password): + # Example custom configuration option + foo = "" + if self.configuration.has_option("auth", "foo"): + foo = self.configuration.get("auth", "foo") + self.logger.info("Configuration option %r is %r", "foo", foo) + + # Check authentication self.logger.info("Login attempt by %r with password %r", user, password) return user == password @@ -49,7 +56,13 @@ python3 -m pip install --upgrade . ``` To make use this great creation in Radicale, set the configuration option -`type` in the `auth` section to `radicale_silly_auth`. +`type` in the `auth` section to `radicale_silly_auth`: + +```ini +[auth] +type = radicale_silly_auth +foo = bar +``` You can uninstall the module with: ```shell