How to add custom DNS records to autodns function?

You can actually define a custom hook as discussed in Share your "hooks" to apply custom configurations- Partagez vos "hooks" pour appliquer des configurations personnelles, but instead of conf_regen, use custom_dns_rules

The custom hook will receive the domain as $1 arg

It’s actually not used in the wild I think … so I’m unsure exactly what’s the behavior but I think it should somehow “return” a json with the record. Something like :

domain=$1
echo '[' >> $YNH_STDRETURN
echo "{'type': 'SRV', 'name': 'stuff.$domain.', 'value': 'yoloswag', 'ttl': 3600}" >> $YNH_STDRETURN
echo ']' >> $YNH_STDRETURN

(dumping json using bash is actually not easy, though easier using json maybe)

(Corresponding piece of code : https://github.com/YunoHost/yunohost/blob/dev/src/dns.py#L288-L302 )

Then you can check the output with yunohost domain dns suggest foobar.tld