relocate .env file loader

This commit is contained in:
debugtalk
2018-07-29 22:44:11 +08:00
parent 5738c368c8
commit 18d7b7ac45
3 changed files with 24 additions and 22 deletions

View File

@@ -375,25 +375,6 @@ def create_scaffold(project_path):
logger.color_print(msg, "BLUE")
def load_dot_env_file(path):
""" load .env file and set to os.environ
"""
if not path:
path = os.path.join(os.getcwd(), ".env")
if not os.path.isfile(path):
logger.log_debug(".env file not exist: {}".format(path))
return
else:
if not os.path.isfile(path):
raise exceptions.FileNotFound("env file not exist: {}".format(path))
logger.log_info("Loading environment variables from {}".format(path))
with io.open(path, 'r', encoding='utf-8') as fp:
for line in fp:
variable, value = line.split("=")
variable = variable.strip()
os.environ[variable] = value.strip()
logger.log_debug("Loaded variable: {}".format(variable))
def validate_json_file(file_list):
""" validate JSON testset format