Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

conf file for options would be helpful #66

Open
netllama opened this issue Aug 23, 2020 · 8 comments
Open

conf file for options would be helpful #66

netllama opened this issue Aug 23, 2020 · 8 comments
Labels
feature Feature request or related

Comments

@netllama
Copy link

Thanks for this project, it looks super useful for integrating into another project that I maintain.

One thing that would help a lot is to support a configuration file that could save options so that they don't need to be provided for every invocation. I'm primarily thinking of the value for the --secret option, but any of them could be handy.

@netllama netllama added the feature Feature request or related label Aug 23, 2020
@pawamoy
Copy link
Owner

pawamoy commented Aug 23, 2020

Oh, I'm pretty sure you can do that with aria2's configuration file, usually located at ~/.config/aria2/aria2.conf. Check out its man pages, everything is explained there.

In your case, you'll want to set the rpc-secretvalue in your configuration file 🙂

@netllama
Copy link
Author

Right, but I already did that, and yet aria2p never uses it. If I invoke aria2c, it finds the value of rpc-secret as expected.

$ aria2p
Traceback (most recent call last):
  File "/usr/local/bin/aria2p", line 10, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.7/site-packages/aria2p/cli.py", line 74, in main
    api.client.get_version()
  File "/usr/local/lib/python3.7/site-packages/aria2p/client.py", line 1478, in get_version
    return self.call(self.GET_VERSION)
  File "/usr/local/lib/python3.7/site-packages/aria2p/client.py", line 234, in call
    return self.res_or_raise(self.post(self.get_payload(method, params, msg_id=msg_id)))
  File "/usr/local/lib/python3.7/site-packages/aria2p/client.py", line 360, in res_or_raise
    raise Client.response_as_exception(response)
aria2p.client.ClientException: Unauthorized
aria2p -s 'blah'
<no exception>

@pawamoy
Copy link
Owner

pawamoy commented Aug 23, 2020

Aaaaah indeed, sorry, I failed to see that. Yes, maybe aria2p could try to read aria2's configuration file when it exists, so it can automatically use the right secret and other options.

@snowman
Copy link

snowman commented Aug 4, 2021

Please consider support aria2p configuration.

@pawamoy
Copy link
Owner

pawamoy commented Aug 4, 2021

I am considering it, just didn't get the time to work on it, PRs welcome 🙂 !

@snowman
Copy link

snowman commented Aug 5, 2021

You can add an alias for aria2p:

alias aria2p="aria2p --secret 343ab16f-cb48-4f15-8f24-e42bf04cb68a"

@skull-squadron
Copy link

It should read the secret from -s for a one-of run (infrequent use and testing) and then fallback to ${XDG_CONFIG_HOME}/aria2p/config.toml SECRET if present (preferred). The problem of passing a secret by CLI argument is that it's insecure and annoying. Reading another program's secrets would be fragile, so doing this should be avoided.

@pawamoy
Copy link
Owner

pawamoy commented Jan 16, 2024

aria2's own config file format is probably super stable. Why do you say it would be fragile?

In any case, we must support setting the secret in an aria2p config file, because both files (aria2 conf and aria2p conf) could be on different hosts, so you're right.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Feature request or related
Projects
None yet
Development

No branches or pull requests

4 participants