What is the syntax to replace a postfix hash-Database, for example
domain.tld PREPEND my-header: foobar
with a static map?
docs define it as Example: "inline:{ key=value, { key = text with whitespace or comma }}"
.
Several ways to replace it seemed not to work and its even unclear, how many fields the hash: db really has. is the domain the only key and the rest a string? Should there be some list-syntax for the three fields associated to the domain? And what about a key with multiple values (multiple lines starting with the same domain in the hash: db)?
First, I'll try to clear some confusions here about postfix lookup table based on official documentation. In short, postfix table must be consisted of key-value pair. Both of key-value has string datatype.
YES. Just ONE key and ONE value. The value has several formats which address different purpose, such as alias, transport, access, etc. See postfix man pages, especially in Table-driven mechanisms section.
Some table support that list-like string. For example alias table allows you to define multiple alias target for example.
In here, the value was separated by space or comma.
When table has duplicate key, then postfix will choose the value of the first match. In case of hash table, the top entry was chosen, the others value were ignored.
Now, I'll try to answer your question about static and/or inline maps. Please note that these two table types were different of each other.
The inline maps will be introduced in postfix version 3.0. Currently there are no postfix stable release that support that table type. You can read it in postfix 3.0 RC1 release notes.
Let say you want to convert hash table with entries like this
Then the equivalent inline maps is
For text without space, we can use key=value syntax. With spaces, you need bracket to surround it.
Now, the static maps was different. The table was like wildcard-key table. Postfix may lookup whatever key, but the answer would be static value. For postfix with version lower 3.0, the static table doesn't support value string with space. For postfix 3.0 and later, you may wrap the the value with bracket to add spaces in it. For example
or