-
Notifications
You must be signed in to change notification settings - Fork 2
Providing an improperly formatted dotenv file silently passes #94
Copy link
Copy link
Open
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is needed
Description
Describe the bug
If using the --dotenv option from the command-line or dotenv: in a Config File and providing a file that is not a dotenv file doesn't cause an error. It would be better to let the user know that they provided an improperly formatted instead of continuing with executing commands and potentially failing later.
To Reproduce
Steps to reproduce the behavior:
- Run
build-magic --dotenv [some file] echo hellowhere[some file]is any file that isn't a dotenv file.
Expected behavior
An improperly formatted dotenv file should raise an error and communicate the impropriety to the user.
Additional context
The dotenv file is read and parsed in cli/parse_dotenv_file() and the logic simply continues to the next line if it doesn't contain an "=":
envs = {}
for line in dotenv.readlines():
if line.startswith('#'):
continue
if '=' not in line:
continue
env, val = line.split('=', maxsplit=1)
envs.update({env.strip(): val.strip()})The checks inside this loop should be replaced with a single step that validates the dotenv file.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is needed