EOX GitLab Instance

Skip to content
Snippets Groups Projects
Commit 633f5aca authored by Mussab Abdalla's avatar Mussab Abdalla
Browse files

enhance variable reading

parent b1dc6913
No related branches found
No related tags found
No related merge requests found
import psycopg2 import psycopg2
import os import os
lines = tuple(open('./env/emg_db.env', 'r'))
for line in lines: with open('./env/emg_db.env', 'r') as f:
variable_key = line.split("=",1)[0] env = dict(
variable = line.split("=",1)[1] line.split('=', 1)
if variable_key == "DB_USER" : for line in f
database_user = variable )
elif variable_key == "DB_PW" : database= env['DB_NAME']
database_password = variable port = env['DB_PORT']
elif variable_key == "DB_HOST" : host = env['DB_HOST']
host = variable database_password= env['DB_PW']
elif variable_key == "DB_PORT" : database_user = env['DB_USER']
port = variable
elif variable_key == "DB_NAME" :
database = variable
def connect_to_db(eo_id): def connect_to_db(eo_id):
global db_name, coverage_id global db_name, coverage_id
......
pytest pytest
psycopg2 psycopg2
python-swiftclient # python-swiftclient
python-keystoneclient # python-keystoneclient
\ No newline at end of file \ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment