diff --git a/config/default.py b/config/default.py index de512b38..d9af6a76 100644 --- a/config/default.py +++ b/config/default.py @@ -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") diff --git a/crc/scripts/get_dashboard_url.py b/crc/scripts/get_dashboard_url.py new file mode 100644 index 00000000..d43971dd --- /dev/null +++ b/crc/scripts/get_dashboard_url.py @@ -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}' diff --git a/tests/test_get_dashboard_url_script.py b/tests/test_get_dashboard_url_script.py new file mode 100644 index 00000000..a464400d --- /dev/null +++ b/tests/test_get_dashboard_url_script.py @@ -0,0 +1,7 @@ +from tests.base_test import BaseTest + + +class TestGetDashboardURL(BaseTest): + + def test_get_dashboard_url(self): + pass