nat-n / poethepoet

A task runner that works well with poetry.
https://poethepoet.natn.io/
MIT License
1.45k stars 59 forks source link

Can poe env support $HOME or ~ , so that user can set his secret info in his HOME path #125

Closed rainmanxp closed 1 year ago

rainmanxp commented 1 year ago

New requirements:

I want set some secret info(such as key) in env file but now poe only support the env file in the project path, for example: [tool.poe] envfile = "./repo.env"

it means my repo.env placed in project home dir, but the info in repo.env is secret, I hope put it in $HOME/repo.env

I saw the [poethepoet] now process the envfile as following: https://github.com/nat-n/poethepoet/blob/main/poethepoet/env/cache.py line:27 envfile_path = self._project_dir.joinpath(envfile_path_str) image

The forward process is not math with my requirements, can you support it ? such as config following: [tool.poe] envfile = "~/repo.env"

or

[tool.poe] envfile = "$HOME/repo.env"

rainmanxp commented 1 year ago

Also I can use the config to workround, but it is not a perfect solution。 [tool.poe] envfile = "../repo.env"

nat-n commented 1 year ago

Hi @rainmanxp, Sure why not...

This should do the trick: https://github.com/nat-n/poethepoet/commit/f83acf0e5364c737c84d979308d7c03dfde55322

In the next release you'll be able to use ~ in the path for envfiles đŸ™‚

nat-n commented 1 year ago

The enhancement is shipped in 0.19.0 đŸ™‚