Aria2.conf "extra_settings" list syntax?

how am I supposed to use a "list" type setting?

specifically for aria2, there's the list extra_settings '' line, which i am about to make ample use of, since none of the extremely essential settings about which port to use (and open on the firewall) are present on the regular settings.

On the docs i can only see "list" being used for things like list 'eth0,eth1' but for aria settings i will need to pass in complex key=value lists, how do i encode it there?

Seems there's an example here:

Ummmm?

key=<value>

  • What do you mean by "encode it there"?
  • And wouldn't that be one of the secret settings?
# We do not support all options at this time. But you can add any option
# with 'list extra_settings'.

I have no idea which one is available or not.

I just assumed the ones in the default config file were present, all others should go into "extra_settings"... even tho the example rpc_secret is not there :confused:

So I actually went with the default set of ports and just opened them all up... but still have some settings i have no idea how to use. Also the syntax is different from aria and opkg aria...

for the opkg config file i have to replace - with _, but the resulting file in /var/etc/aria.conf have the usual -... i'm assuming the text in "extra_config" will be put there as is?

i'm testing with

list extra_settings 'bt-save-metadata=true,max-upload-limit=2M,seed-ratio=2.0,'

not sure how to check if either can be used "raw"

ok, i should have just tested.

        option bt_save_metadata 'true'                                                  
        option max_upload_limit '2M'                                                    
        option seed_ratio '2.0'                                                         
        list extra_settings ''                                                          
        #list extra_settings 'bt-save-metadata=true,max-upload-limit=2M,seed-ratio=2.0,'

after /etc/init.d/aria2 restart i can see it understood all the settings

# cat /var/etc/aria2/aria2.conf.main
...
max-upload-limit=2M
save-session-interval=30
seed-ratio=2.0
1 Like

for the record, there are some dangerous omissions there:

# /etc/config/aria2
option rpc_listen_all 'false'

is silently ignored and an oposite default is used instead

# /var/etc/aria2/aria2.conf.main
enable-rpc=true
rpc-allow-origin-all=true
rpc-listen-all=true

(these three options by default without certs/secrets is kinda dangerous)

So, i'm back to my original question: how to use a list option type?

commas, fail

# /etc/config/aria2
list extra_settings 'enable-rpc=true,rpc-allow-origin-all=false,rpc-listen-all=false'

restart, cat /var/etc/aria2/aria2.conf.main

enable-rpc=true
rpc-allow-origin-all=true
rpc-listen-all=true
...
enable-rpc=true,rpc-allow-origin-all=false,rpc-listen-all=false

harmful defaults still there, and extra_options fail

\n, fail

same with

list extra_settings 'enable-rpc=true\nrpc-allow-origin-all=false\nrpc-listen-all=false'
enable-rpc=true
rpc-allow-origin-all=true
rpc-listen-all=true
...
enable-rpc=true\nrpc-allow-origin-all=false\nrpc-listen-all=false

after some more trials, seems I just have to repeat them

        list extra_settings 'enable-rpc=true'
        list extra_settings 'rpc-allow-origin-all=false'
        list extra_settings 'rpc-listen-all=false'

and hope whatever is reading the resulting file accepts the last-most duplicate line for the harmful defaults i want to override, as oposed to first-most (like .ssh/config etc)

edit: for aria adding lines to the bottom does override

# netstat -apn | grep aria
tcp        0      0 127.0.0.1:6800          0.0.0.0:*               LISTEN      19414/aria2c
tcp        0      0 ::1:6800                :::*                    LISTEN      19414/aria2c
1 Like

I'm confused. Are you saying that you're adding conflicting configs, commas and \n on purpose and wondering why you're having issues?

I am saying several things.

First, the most important, the config module for some services have a feature where they convert a curated list of settings. They provide you snake_case settings and output a file that uses kebab-case (or whatever the generated file uses). BUT not all settings are in that list, and the ones that are not will just be ignored! And sometime the ignored setting have a default value!

Second, i'm saying that there is a catch-all option called extra_settings, which takes a list type (reason of my question, it is not well documented) and put that on the final conf file "as is" at the bottom (important for point #3 bellow). I figured out that the "list" type is just a string type where you can specify it several times and it adds, instead of overriding itself. One line at a time.

third, i connect the two points. From point #1, if the resulting setting have a=1 and does not provide a way to set a... you have to set it via extra_settings. Then your final generated config file will have a=1 from the fixed template and at the bottom a=2 that you set via extra_settings. Which for aria was fine, but if i needed this for a service where first-match-wins, like ssh_config, i'd be screwed.