foxcpp / foxcpp/maddy

How can I pull local_domains from table.sql_query

Open
#731 1 comment 0 reactions 0 assignees View on GitHub
new feature
Dominant language
Go
Stars
6.1k
Forks
327
PR merge metrics
No merged PRs in 30d

Description

# Use case

I am building a systme where I add domains to maddy via api. I have already built the api part (if anyone finds this useful I'm happy to share). Now I'd like to, inatead of passing local_domains via ENV, read them from a postgres table, in a way that I do not need to restart maddy to make these domains visible to the modules.

Note alternatives you considered and why they are not useful.

# Your idea for a solution
Tried this
```
table.sql_query allowed_domains {
driver postgres
named_args no
dsn "postgres dsn"
lookup "SELECT domain FROM domains where domain = $1"
list "SELECT domain FROM domains"
}

whatever {
modify {
dkim {
domains $(primary_domain) $(local_domains) &allowed_domains
selector default
key_path dkim-keys/{domain}-{selector}.key
sig_expiry 120h # 5 days
hash sha256
newkey_algo rsa2048
}
}
}
```
How your solution would work in general?

Did not, domains are not in the list

- [x ] I'm willing to help with the implementation

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.