mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-12-27 03:44:19 +00:00
23 lines
748 B
Python
23 lines
748 B
Python
|
from sqlalchemy import create_engine
|
||
|
from sqlalchemy.orm import scoped_session, sessionmaker
|
||
|
import os
|
||
|
import docker
|
||
|
|
||
|
''' Global constants '''
|
||
|
NOPAQUE_STORAGE = os.environ.get('NOPAQUE_STORAGE')
|
||
|
|
||
|
''' Docker client '''
|
||
|
docker_client = docker.from_env()
|
||
|
docker_client.login(password=os.environ.get('GITLAB_PASSWORD'),
|
||
|
registry="gitlab.ub.uni-bielefeld.de:4567",
|
||
|
username=os.environ.get('GITLAB_USERNAME'))
|
||
|
|
||
|
''' Scoped session '''
|
||
|
engine = create_engine(
|
||
|
'postgresql://{}:{}@db/{}'.format(
|
||
|
os.environ.get('POSTGRES_USER'),
|
||
|
os.environ.get('POSTGRES_PASSWORD'),
|
||
|
os.environ.get('POSTGRES_DB_NAME')))
|
||
|
session_factory = sessionmaker(bind=engine)
|
||
|
Session = scoped_session(session_factory)
|