Commit d14898ad68bd04757399dba096dca550e47377ce
1 parent
dd54dc29
Exists in
dev
Updating function to read and check environment variables
Showing
1 changed file
with
8 additions
and
2 deletions
Show diff stats
pyros.py
... | ... | @@ -298,8 +298,13 @@ def set_environment_variables_if_not_configured(env_path: str,env_sample_path: s |
298 | 298 | env_path (str): path to .env file |
299 | 299 | env_sample_path (str): path to .env-sample file |
300 | 300 | """ |
301 | - is_environment_variables_not_defined = os.environ.get("MYSQL_ROOT_PASSWORD") == None or os.environ.get("MYSQL_ROOT_LOGIN") == None or os.environ.get("MYSQL_PYROS_LOGIN") == None or os.environ.get("MYSQL_PYROS_PWD") == None | |
302 | - if(is_environment_variables_not_defined): | |
301 | + variables_names = ["MYSQL_ROOT_PASSWORD","MYSQL_ROOT_LOGIN","MYSQL_TCP_PORT","MYSQL_PYROS_LOGIN","MYSQL_PYROS_PWD","PATH_TO_OBSCONF_FILE"] | |
302 | + is_environment_variables_defined = True | |
303 | + while(is_environment_variables_defined): | |
304 | + for variable in variables_names: | |
305 | + if( os.environ.get(variable) is None): | |
306 | + is_environment_variables_defined = False | |
307 | + if(not is_environment_variables_defined): | |
303 | 308 | print("Some environment variables are not configured...") |
304 | 309 | try: |
305 | 310 | with open(env_path,"r") as env_file: |
... | ... | @@ -328,6 +333,7 @@ def set_environment_variables_if_not_configured(env_path: str,env_sample_path: s |
328 | 333 | |
329 | 334 | |
330 | 335 | |
336 | + | |
331 | 337 | """ |
332 | 338 | ******************************************************************************** |
333 | 339 | ******************** CLI COMMANDS DEFINITION (click format) ******************** | ... | ... |