nextdns icon indicating copy to clipboard operation
nextdns copied to clipboard

Sort config file when saving it on upgrade

Open timkgh opened this issue 4 years ago • 2 comments

Every upgrade of nextdns cli re-writes the config file. I keep the settings in the file sorted as they are easier to find and also match the output of nextdns run --help.

It would help to have the config file sorted on save.

timkgh avatar Sep 18 '21 21:09 timkgh

What kind of sort should be preferred here? By alphabet or by the function?

I also found that the order inside the config file that generated by NextDNS cli is actually different from the output of nextdns config list 😆

$ nextdns config list
setup-router true
cache-size 10MB
cache-max-age 0s
discovery-dns 
use-hosts true
listen localhost:53
control /var/run/nextdns.sock
config xxxxxx
auto-activate false
max-ttl 0s
report-client-info true
mdns all
bogus-priv true
max-inflight-requests 256
log-queries false
detect-captive-portals false
hardened-privacy false
timeout 5s
$ cat /etc/nextdns.conf 
bogus-priv true
setup-router true
cache-size 10MB
mdns all
hardened-privacy false
report-client-info true
detect-captive-portals false
timeout 5s
listen localhost:53
control /var/run/nextdns.sock
use-hosts true
auto-activate false
config xxxxxx
cache-max-age 0s
discovery-dns 
log-queries false
max-ttl 0s
max-inflight-requests 256

PeterDaveHello avatar Mar 31 '22 17:03 PeterDaveHello

Alphabetical. Easier to visually find a setting in the file, easier to diff two versions of the config file. Same for nextdns config list, it should sort the output the same way.

timkgh avatar Mar 31 '22 19:03 timkgh