Use a new INSTANCE_NAME variable for this, instead of SERVER_NAME

This commit is contained in:
mike cullerton 2022-05-17 09:59:33 -04:00
parent 5230ad8ee7
commit 1b4821d2b9
2 changed files with 5 additions and 4 deletions

View File

@ -16,6 +16,7 @@ API_TOKEN = environ.get('API_TOKEN', default = 'af95596f327c9ecc007b60414fc84b61
NAME = "CR Connect Workflow" NAME = "CR Connect Workflow"
SERVER_NAME = environ.get('SERVER_NAME', default="localhost:5000") SERVER_NAME = environ.get('SERVER_NAME', default="localhost:5000")
INSTANCE_NAME = environ.get('INSTANCE_NAME', default='development')
DEFAULT_PORT = "5000" DEFAULT_PORT = "5000"
FLASK_PORT = environ.get('PORT0') or environ.get('FLASK_PORT', default=DEFAULT_PORT) FLASK_PORT = environ.get('PORT0') or environ.get('FLASK_PORT', default=DEFAULT_PORT)
FRONTEND = environ.get('FRONTEND', default="localhost:4200") FRONTEND = environ.get('FRONTEND', default="localhost:4200")

View File

@ -5,14 +5,14 @@ from crc.scripts.script import Script
class GetInstance(Script): class GetInstance(Script):
def get_description(self): def get_description(self):
return """Get the name of the current instance, using the SERVER_NAME environment variable.""" return """Get the name of the current instance, using the INSTANCE_NAME environment variable."""
def do_task_validate_only(self, task, study_id, workflow_id, *args, **kwargs): def do_task_validate_only(self, task, study_id, workflow_id, *args, **kwargs):
return self.do_task(task, study_id, workflow_id, *args, **kwargs) return self.do_task(task, study_id, workflow_id, *args, **kwargs)
def do_task(self, task, study_id, workflow_id, *args, **kwargs): def do_task(self, task, study_id, workflow_id, *args, **kwargs):
if 'SERVER_NAME' in app.config: if 'INSTANCE_NAME' in app.config:
return app.config['SERVER_NAME'] return app.config['INSTANCE_NAME']
# TODO: Not sure what we should do here # TODO: Not sure what we should do here
app.logger.info('no_server_name: SERVER_NAME not configured for this server.') app.logger.info('no_instance_name: INSTANCE_NAME not configured for this server.')
return '' return ''