Start for ticket 230 - Get Dashboard URL

This commit is contained in:
mike cullerton 2021-05-06 14:07:21 -04:00
parent 620b9a5188
commit 09a395fa34
3 changed files with 24 additions and 0 deletions

View File

@ -17,6 +17,7 @@ API_TOKEN = environ.get('API_TOKEN', default = 'af95596f327c9ecc007b60414fc84b61
NAME = "CR Connect Workflow"
DEFAULT_PORT = "5000"
FLASK_PORT = environ.get('PORT0') or environ.get('FLASK_PORT', default=DEFAULT_PORT)
FRONTEND = "localhost:4200"
CORS_ALLOW_ORIGINS = re.split(r',\s*', environ.get('CORS_ALLOW_ORIGINS', default="localhost:4200, localhost:5002"))
TESTING = environ.get('TESTING', default="false") == "true"
PRODUCTION = (environ.get('PRODUCTION', default="false") == "true")

View File

@ -0,0 +1,16 @@
from crc.scripts.script import Script
from crc import app
class GetDashboardURL(Script):
def get_description(self):
"""Get the URL for the main dashboard. This should be system instance aware.
I.e., dev, testing, production, etc."""
def do_task_validate_only(self, task, study_id, workflow_id, *args, **kwargs):
self.do_task(task, study_id, workflow_id, *args, **kwargs)
def do_task(self, task, study_id, workflow_id, *args, **kwargs):
frontend = app.config['FRONTEND']
return f'http://{frontend}'

View File

@ -0,0 +1,7 @@
from tests.base_test import BaseTest
class TestGetDashboardURL(BaseTest):
def test_get_dashboard_url(self):
pass