Skip to content

Set env variable value using task option #248

Answered by nat-n
pklejch asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @pklejch, I just got around to looking at this properly and now I see that I misunderstood your problem the first time, so I deleted my original answer.

I understand you want your task to set AWS_PROFILE based on the --profile arg with a fallback to inheriting it from the environment. The approach is reasonable doesn't work because as it happens poe resolves the env for the task from other options before parsing the task arguments (so a CLI argument could have a default value based on the env task option, but not vice versa).

However, since arg values are actually set as environment variables, you can still get what you what simply by renaming the arg like so:

[tool.poe.tasks.my_task]
cmd

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@pklejch
Comment options

Answer selected by pklejch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants