Add entry to domains cfg in uci

Greetings,

is there an easy way to add an entry to domain without running grep on the config?
initially I tried using this:

set dhcp.@domain[-1]=domain
set dhcp.@domain[-1].name='${HOSTNAME}'
set dhcp.@domain[-1].ip='${ASSIGNED_IP}'

which just overwrote the last entry. I'm looking for an append behavior.

Thanks,

Dagg.

You can edit the relevant UCI file: /etc/config/dhcp

Append the following:

config domain
	option name 'foo.lan'
	option ip '192.168.xxx.1'

https://openwrt.org/docs/guide-user/base-system/uci#usage

In particular, look at add and add_list