-
-
Notifications
You must be signed in to change notification settings - Fork 262
Closed
Labels
✨ enhancementNew feature or improvementNew feature or improvement
Description
Is your feature request related to a problem? Please describe.
I think by allowing custom input kwargs in self.env.globals, custom templates can be more powerful.
For example, I want to extend client.py.jinja2 by using an additional global env var: auth_method=True:
client_kwargs = self.client_kwargs.copy()
{% if auth_method == "token" -%}
token = self.token.get_secret_value()
prefix = "Bearer"
{% elif auth_method == "username_password" -%}
# to authenticate with username password as a header, need to encode;
# taken from https://stackoverflow.com/questions/6999565/
token = b64encode(
bytes(f"{self.username}:{self.password}", "utf-8")
).decode("ascii")
client = AuthenticatedClient(
base_url=base_url,
token=token,
prefix=prefix,
timeout=timeout,
**client_kwargs
)
Describe the solution you'd like
A clear and concise description of what you want to happen.
In Project.__init__, a keyword:
custom_global_vars: Dict[str, Any] = NoneIf this is accepted, I'm happy to help contribute a PR
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Manually selecting the template on runtime
Additional context
Add any other context or screenshots about the feature request here.
Metadata
Metadata
Assignees
Labels
✨ enhancementNew feature or improvementNew feature or improvement