.env file ignore blank lines and comments

This commit is contained in:
lan
2022-01-18 17:33:51 +08:00
parent 822ae88c77
commit 651a8e4ae0

View File

@@ -130,6 +130,9 @@ def load_dot_env_file(dot_env_path: Text) -> Dict:
with open(dot_env_path, mode="rb") as fp:
for line in fp:
# maxsplit=1
line = line.strip()
if not len(line) or line.startswith(b"#"):
continue
if b"=" in line:
variable, value = line.split(b"=", 1)
elif b":" in line: