dovecot-2.1-pigeonhole: Finished documentation example for SQL d...

pigeonhole at rename-it.nl pigeonhole at rename-it.nl
Sun Apr 22 16:36:11 EEST 2012


details:   http://hg.rename-it.nl/dovecot-2.1-pigeonhole/rev/d07dad1ad41c
changeset: 1613:d07dad1ad41c
user:      Stephan Bosch <stephan at rename-it.nl>
date:      Sun Apr 22 15:36:06 2012 +0200
description:
Finished documentation example for SQL dict script location type.

diffstat:

 doc/script-location-dict.txt |  63 +++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 60 insertions(+), 3 deletions(-)

diffs (75 lines):

diff -r 3161dcf7cd8e -r d07dad1ad41c doc/script-location-dict.txt
--- a/doc/script-location-dict.txt	Sun Apr 22 15:11:14 2012 +0200
+++ b/doc/script-location-dict.txt	Sun Apr 22 15:36:06 2012 +0200
@@ -78,11 +78,68 @@
   sieve = dict:file:/etc/dovecot/sieve.dict;name=keep;bindir=~/.sieve-bin
 }
 
-Binaries are stored in the ~/.sieve-bin directory. 
+The Sieve script named "keep" is retrieved from the file dict as the main
+script. Binaries are stored in the ~/.sieve-bin directory. 
 
 Example 2
 ---------
 
-This example uses a sqlite database. 
+This example uses a PostgreSQL database. Our database contains the following
+table:
 
-FIXME: 
+CREATE TABLE user_sieve_scripts (
+  id integer,
+  username varchar(40),
+  script_name varchar(256),
+  script_data varchar(10240),
+
+  PRIMARY KEY (id),
+  UNIQUE(username, script_name)
+);
+
+We create a file /etc/dovecot/dict-sieve-sql.conf with the following content:
+
+connect = host=localhost dbname=dovecot user=dovecot password=password
+map {
+  pattern = priv/sieve/name/$script_name
+  table = user_sieve_scripts
+  username_field = username
+  value_field = id
+  fields {
+    script_name = $script_name
+  }
+}
+map {
+  pattern = priv/sieve/data/$id
+  table = user_sieve_scripts
+  username_field = username
+  value_field = script_data
+  fields {
+    id = $id
+  }
+}
+
+These are the mappings used by the SQL dict. The first mapping is the name query
+that yields the id of the Sieve script. The second mapping is the query used to
+retrieve the Sieve script itself.
+
+Much like the dict configuration for mailbox quota, it is often not possible to
+directly use an SQL dict because the SQL drivers are not linked to binaries such
+as dovecot-lda and lmtp. You need to use the dict proxy service. Add the dict
+URI to the dict section (typically located in your main dovecot.conf):
+
+dict {
+  sieve = pgsql:/etc/dovecot/dict-sieve-sql.conf.ext
+}
+
+To use this SQL dict for the main active script, you can change the
+configuration as follows (e.g. in /etc/dovecot/conf.d/90-sieve.conf):
+
+plugin {
+  sieve = dict:proxy::sieve;name=active;bindir=~/.sieve-bin
+}
+
+This uses the proxy dict uri `proxy::sieve'. This refers to the `sieve =' entry
+in the dict {...} section above. With this configuration, a Sieve script called
+"main" is retrieved from the SQL dict. Binaries are stored in the ~/.sieve-bin
+directory.


More information about the dovecot-cvs mailing list