Setup $(local_domains) from table instead of maddy.conf
Use case
I'd like to load $(local_domains) from a table like sqlite. Right now I need to specify domains in maddy.conf but my accounts and aliases are all setup inside sqlite.
Your idea for a solution
- [ ] I'm willing to help with the implementation
0.5 will introduce table.chain that can be used to combine multiple table modules.
What you want would be possible by pulling together table.regexp and table.sql_query/sql_table.
For example, this "table" will define all possible addresses:
table.chain possible_addrs {
step regexp ".+@(.+)" "$1"
step sql_table {
driver sqlite3
dsn credentials.db
table_name domains
}
}
(Basically, first step extracts domain from the address and second looks that domain up in a DB table)
Then relevant destination directives could be replaced with destination_in:
E.g.
destination_in &possible_addrs {
deliver_to &local_routing
}
Would it also be possible to have a generic configuration for a catch-all which fetches an optional catch-all target address for addresses that don't exist from a table?
Rewritting all addresses to an internal address like [email protected] and then looking it up in the table should be the way to go:
table.chain catch_all {
step regexp ".*" "[email protected]"
step sql_table {
driver sqlite3
dsn catchalldb
table_name catchall
}
}