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

Make scripts path relative to config file #4880

Open
Speedlulu opened this issue Oct 25, 2021 · 3 comments
Open

Make scripts path relative to config file #4880

Speedlulu opened this issue Oct 25, 2021 · 3 comments
Labels
kind/feature New features / enhancements

Comments

@Speedlulu
Copy link
Contributor

Problem Description

Currently mitm commands will load scripts found in config.yaml relatively from where the command is ran which is fine when using the cli option -s but seems counter-intuitive when using a config file.

Current behaviour :

$ mitmproxy --set confdir=proxy
/home/lficheux/.local/bin/mitmproxy: Error reading proxy/config.yaml: No such script
$ tree proxy
proxy
├── addons
│   └── addons.py
├── config.yaml
$ cat proxy/config.yaml
scripts: ['./addons/addons.py', ]

(The error message could also do with a bit more verbosity in my opinion, I could do another PR for that.)

Proposal

Make scripts path relative to the config file they come from. If scripts path come from the cli option -s do nothing.
I have already made a pull request : #4860

Alternatives

  • Using absolute paths but that defeats the point.
@Speedlulu Speedlulu added the kind/feature New features / enhancements label Oct 25, 2021
@mhils
Copy link
Member

mhils commented Oct 25, 2021

Thanks! I think that's a useful change in general and your PR looks good on the surface. I won't find the time to review this properly in the next few weeks. Either we'll find someone else to look properly at this, or I'll likely handle it in December or so. 😃

@Speedlulu
Copy link
Contributor Author

Alrighty thanks ! Let me know if I can do anything to help along the way :)

@Speedlulu
Copy link
Contributor Author

I updated the PR :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature New features / enhancements
Projects
None yet
Development

No branches or pull requests

2 participants