set redis host and port from config

This commit is contained in:
Jordan Rodgers 2018-01-24 00:30:08 -05:00
parent a80a6e270f
commit 6d36ced3b3
2 changed files with 7 additions and 3 deletions

View file

@ -47,3 +47,7 @@ LDAP_BIND_PW = environ.get('PROXSTAR_LDAP_BIND_PW', '')
# DB # DB
SQLALCHEMY_DATABASE_URI = environ.get('PROXSTAR_SQLALCHEMY_DATABASE_URI', '') SQLALCHEMY_DATABASE_URI = environ.get('PROXSTAR_SQLALCHEMY_DATABASE_URI', '')
# REDIS
REDIS_HOST = environ.get('PROXSTAR_REDIS_HOST', 'localhost')
REDIS_PORT = int(environ.get('PROXSTAR_REDIS_PORT', '6379'))

View file

@ -14,9 +14,6 @@ from proxstar.starrs import *
from proxstar.ldapdb import * from proxstar.ldapdb import *
from proxstar.proxmox import * from proxstar.proxmox import *
redis_conn = Redis('redis', 6789)
q = Queue(connection=redis_conn)
app = Flask(__name__) app = Flask(__name__)
if os.path.exists( if os.path.exists(
os.path.join( os.path.join(
@ -34,6 +31,9 @@ auth = OIDCAuthentication(
client_registration_info=app.config['OIDC_CLIENT_CONFIG']) client_registration_info=app.config['OIDC_CLIENT_CONFIG'])
cache = SimpleCache() cache = SimpleCache()
redis_conn = Redis(app.config['REDIS_HOST'], app.config['REDIS_PORT'])
q = Queue(connection=redis_conn)
engine = create_engine(app.config['SQLALCHEMY_DATABASE_URI']) engine = create_engine(app.config['SQLALCHEMY_DATABASE_URI'])
Base.metadata.bind = engine Base.metadata.bind = engine
DBSession = sessionmaker(bind=engine) DBSession = sessionmaker(bind=engine)