Environment Variables #552
Answered
by
jayqi
CruzanCaramele
asked this question in
Questions
First Check
Commit to Help
Example Code@app.command(short_help="Creates Secrets")
def create(
name: str = typer.Option(None, "--token-name", help="The name of the token."),
auth: str = typer.Option(
None,
"--auth",
envvar="AUTH_TOKEN",
help=".....",
),
config: Optional[Path] = typer.Option(
None,
exists=True,
readable=True,
file_okay=True,
resolve_path=True,
),
):DescriptionIn the above example function definition, is there a way to make the argument environment variable auth key envvar="AUTH_TOKEN" to be defined by the user instead, rather than hardcoding AUTH_TOKEN ? Operating SystemWindows Operating System DetailsNo response Typer Version0.7.0 Python VersionPython 3.11.0 Additional ContextNo response |
Answered by
jayqi
Feb 22, 2023
Replies: 1 comment
|
Have you considered changing your command's API to take an environment variable name as an option and then read from that environment variable internal to the command? That seems like the clearest way to do things. I don't think you could otherwise make one |
0 replies
Answer selected by
YuriiMotov
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Have you considered changing your command's API to take an environment variable name as an option and then read from that environment variable internal to the command? That seems like the clearest way to do things. I don't think you could otherwise make one
--authoption mean two different things cleanly.