mirror of
https://github.com/sartography/cr-connect-workflow.git
synced 2025-02-23 13:18:35 +00:00
New script that returns the SERVER_NAME of the current instance
This commit is contained in:
parent
063da419d0
commit
15d9eea96b
18
crc/scripts/get_instance.py
Normal file
18
crc/scripts/get_instance.py
Normal file
@ -0,0 +1,18 @@
|
||||
from crc import app
|
||||
from crc.scripts.script import Script
|
||||
|
||||
|
||||
class GetInstance(Script):
|
||||
|
||||
def get_description(self):
|
||||
return """Get the name of the current instance, using the SERVER_NAME environment variable."""
|
||||
|
||||
def do_task_validate_only(self, 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):
|
||||
if 'SERVER_NAME' in app.config:
|
||||
return app.config['SERVER_NAME']
|
||||
# TODO: Not sure what we should do here
|
||||
app.logger.info('no_server_name: SERVER_NAME not configured for this server.')
|
||||
return ''
|
Loading…
x
Reference in New Issue
Block a user