Use shared access for synthetic breast follow-up
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
import argparse
|
||||
import os
|
||||
from pathlib import Path
|
||||
import secrets
|
||||
import sys
|
||||
import types
|
||||
|
||||
@@ -14,9 +13,8 @@ args = parser.parse_args()
|
||||
database = Path(args.database).resolve(strict=True)
|
||||
if not database.is_file():
|
||||
raise ValueError('The synthetic database must be an existing file')
|
||||
token = secrets.token_hex(32)
|
||||
os.environ.update(CAMA_DATABASE_URL='sqlite:///' + database.as_posix(),
|
||||
CAMA_COHORT_ACCESS_TOKEN=token, MLFLOW_DISABLE_AGENT_HINT='1',
|
||||
MLFLOW_DISABLE_AGENT_HINT='1',
|
||||
MLFLOW_DISABLE_TELEMETRY='true')
|
||||
for domain in ('CACU', 'TEA', 'GOVERNANCE'):
|
||||
os.environ[domain + '_DATABASE_URL'] = 'sqlite:///:memory:'
|
||||
@@ -32,12 +30,5 @@ from webapi import create_app
|
||||
from werkzeug.serving import make_server
|
||||
|
||||
app = create_app()
|
||||
application = app.wsgi_app
|
||||
|
||||
def test_proxy(environ, start_response):
|
||||
# The harness is loopback-only and replaces any caller-supplied test token.
|
||||
environ['HTTP_X_CAMA_COHORT_TOKEN'] = token
|
||||
return application(environ, start_response)
|
||||
|
||||
print(f'Isolated synthetic test proxy: http://127.0.0.1:{args.port}', flush=True)
|
||||
make_server('127.0.0.1', args.port, test_proxy, threaded=True).serve_forever()
|
||||
make_server('127.0.0.1', args.port, app, threaded=True).serve_forever()
|
||||
|
||||
Reference in New Issue
Block a user