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 os
lines = tuple(open('./env/emg_db.env', 'r'))
for line in lines:
variable_key = line.split("=",1)[0]
variable = line.split("=",1)[1]
if variable_key == "DB_USER" :
database_user = variable
elif variable_key == "DB_PW" :
database_password = variable
elif variable_key == "DB_HOST" :
host = variable
elif variable_key == "DB_PORT" :
port = variable
elif variable_key == "DB_NAME" :
database = variable
with open('./env/emg_db.env', 'r') as f:
env = dict(
line.split('=', 1)
for line in f
)
database= env['DB_NAME']
port = env['DB_PORT']
host = env['DB_HOST']
database_password= env['DB_PW']
database_user = env['DB_USER']
def connect_to_db(eo_id):
global db_name, coverage_id
......
pytest
psycopg2
python-swiftclient
python-keystoneclient
\ No newline at end of file
# python-swiftclient
# python-keystoneclient
\ 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