stackbuilders / dotenv-hs

Load environment variables from dotenv files for Haskell
https://hackage.haskell.org/package/dotenv
MIT License
65 stars 14 forks source link

Add a flag to allow verification of environment variables before program execution #159

Closed FranzGB closed 1 year ago

FranzGB commented 1 year ago

The current Dotenv CLI executes the program by utilizing the environment variables provided. The --verbose flag can be used to display the loaded environment variables as shown in the following example:

dotenv -f .env.db -f .env.api --verbose 'run.sh'
[INFO] DB_NAME = Prod
[INFO] DB_PASS = 1234
...

However, a concerning issue arises where the program will be executed regardless of the provided environment variables, even if they are missing or do not meet the required criteria. To mitigate this issue, it is recommended to implement a solution that allows for the verification of environment variables prior to program execution.

Proposal:

As @jpvillaisaza mentioned we could implement a --show or a --dry-run flag that facilitates the user in examining the environment variables, without executing the program. The primary advantage of this approach is the prevention of program execution with incorrect or unsatisfactory environment variables.

CristhianMotoche commented 1 year ago

Hey @FranzGB I've assigned @flandrade to solve this issue. Could you please follow up with her on the development of this feature?

CristhianMotoche commented 1 year ago

Hey @flandrade Do you think you can work on this and #160 ? Let us know if you need any help with that.