Update API code to function in all (local/dev/production) environments

add-new-regnum-params
Mike Benowitz 2019-07-08 16:55:30 -04:00
parent b526c072a1
commit 0675146f38
3 changed files with 10 additions and 6 deletions

View File

@ -31,6 +31,8 @@ application.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://{}:{}@{}:{}/{}'.fo
os.environ['DB_PORT'],
os.environ['DB_NAME']
)
application.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
application.config['ELASTICSEARCH_INDEX_URI'] = '{}:{}'.format(
os.environ['ES_HOST'],
os.environ['ES_PORT']

View File

@ -1,6 +1,7 @@
from flask_sqlalchemy import SQLAlchemy
from model.cce import CCE
from model.errorCCE import ErrorCCE
from model.registration import Registration
from model.renewal import Renewal, RENEWAL_REG
from model.volume import Volume

13
main.py
View File

@ -3,11 +3,6 @@ from datetime import datetime, timedelta
import os
import yaml
from sessionManager import SessionManager
from builder import CCEReader, CCEFile
from renBuilder import CCRReader, CCRFile
from esIndexer import ESIndexer
def main(secondsAgo=None, year=None, exclude=None, reinit=False):
manager = SessionManager()
@ -25,7 +20,7 @@ def main(secondsAgo=None, year=None, exclude=None, reinit=False):
if exclude != 'ccr':
loadCCR(manager, loadFromTime, year)
indexUpdates(manager, None)
indexUpdates(manager, loadFromTime)
manager.closeConnection()
@ -81,6 +76,12 @@ if __name__ == '__main__':
loadConfig()
except FileNotFoundError:
pass
from sessionManager import SessionManager
from builder import CCEReader, CCEFile
from renBuilder import CCRReader, CCRFile
from esIndexer import ESIndexer
main(
secondsAgo=args.time,
year=args.year,