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)