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

[Plugins] Adding Command Line Arguments in Plugins #1032

Closed
softhub-software-development opened this issue Jan 21, 2022 · 3 comments
Closed
Assignees
Labels
Duplicate Marked as duplicate of another issue

Comments

@softhub-software-development
Copy link

softhub-software-development commented Jan 21, 2022

In v2.3.1 it was possible to define command line parameters in plugins like the following:

flags.add_argument(
'--some-arg',
 type=str,
 default='something',
 help='some help text'
)

In later versions, like v2.4.0.rc6, in case the parameter is used in an embedded scenario,
that is, proxy.main() is called with kwargs, one would need to specially handle arguments in flags.py.


args.some_arg = cast(
Optional[str], opts.get(
'some_arg',
 args.some_arg,
),
)


otherwise the default value of the argument is always used and there is no way to overwrite
the flag in the command line.

@abhinavsingh
Copy link
Owner

@softhub-software-development You most likely ran into #871

@abhinavsingh abhinavsingh added Duplicate Marked as duplicate of another issue and removed Bug Bug report in proxy server labels Jan 21, 2022
@abhinavsingh
Copy link
Owner

Closed as duplicate. Work around is mentioned in the parent issue. Kindly use the same. Happy to see contributions fixing it :D

@abhinavsingh
Copy link
Owner

Also see skeleton app https://github.com/abhinavsingh/proxy.py/blob/develop/skeleton/app/app.py#L22 which was added as a starter template

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate Marked as duplicate of another issue
Projects
None yet
Development

No branches or pull requests

2 participants