Merge branch 'changes/enable_env_vars' into 'master'
Handled environment variables to be consistent See merge request caimira/caimira!486
This commit is contained in:
commit
600830a495
6 changed files with 18 additions and 12 deletions
|
|
@ -361,7 +361,7 @@ $ oc create secret generic \
|
|||
|
||||
The CERN data service collects data from various sources and expose them via a REST API endpoint.
|
||||
|
||||
To enable the service set the environment variable `DATA_SERVICE_ENABLED` as `True`.
|
||||
The service is enabled when the environment variable `DATA_SERVICE_ENABLED` is set to 1.
|
||||
|
||||
## Update configuration
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,8 @@ if [[ "$APP_NAME" == "calculator-app" ]]; then
|
|||
|
||||
export "EXTRA_PAGES"="$EXTRA_PAGES"
|
||||
|
||||
export "DATA_SERVICE_ENABLED"="${DATA_SERVICE_ENABLED:=False}"
|
||||
export "DATA_SERVICE_ENABLED"="${DATA_SERVICE_ENABLED:=0}"
|
||||
export "CAIMIRA_PROFILER_ENABLED"="${CAIMIRA_PROFILER_ENABLED:=0}"
|
||||
|
||||
echo "Starting the caimira webservice with: python -m caimira.apps.calculator ${args[@]}"
|
||||
python -m caimira.apps.calculator "${args[@]}"
|
||||
|
|
|
|||
|
|
@ -20,7 +20,8 @@ services:
|
|||
- APPLICATION_ROOT=/
|
||||
- CAIMIRA_CALCULATOR_PREFIX=/calculator-cern
|
||||
- CAIMIRA_THEME=caimira/apps/templates/cern
|
||||
- DATA_SERVICE_ENABLED=False
|
||||
- DATA_SERVICE_ENABLED=0
|
||||
- CAIMIRA_PROFILER_ENABLED=0
|
||||
user: ${CURRENT_UID}
|
||||
|
||||
calculator-open-app:
|
||||
|
|
@ -30,7 +31,8 @@ services:
|
|||
- APP_NAME=calculator-app
|
||||
- APPLICATION_ROOT=/
|
||||
- CAIMIRA_CALCULATOR_PREFIX=/calculator-open
|
||||
- DATA_SERVICE_ENABLED=False
|
||||
- DATA_SERVICE_ENABLED=0
|
||||
- CAIMIRA_PROFILER_ENABLED=0
|
||||
user: ${CURRENT_UID}
|
||||
|
||||
auth-service:
|
||||
|
|
|
|||
|
|
@ -284,7 +284,9 @@
|
|||
key: ARVE_API_KEY
|
||||
name: arve-api
|
||||
- name: DATA_SERVICE_ENABLED
|
||||
value: 'True'
|
||||
value: '0'
|
||||
- name: CAIMIRA_PROFILER_ENABLED
|
||||
value: '1'
|
||||
image: '${PROJECT_NAME}/calculator-app'
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
|
|
@ -363,7 +365,9 @@
|
|||
- name: CAIMIRA_CALCULATOR_PREFIX
|
||||
value: /calculator-open
|
||||
- name: DATA_SERVICE_ENABLED
|
||||
value: 'True'
|
||||
value: '0'
|
||||
- name: CAIMIRA_PROFILER_ENABLED
|
||||
value: '1'
|
||||
image: '${PROJECT_NAME}/calculator-app'
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
|
|
|
|||
|
|
@ -563,9 +563,8 @@ def make_app(
|
|||
|
||||
data_registry = DataRegistry()
|
||||
data_service = None
|
||||
data_service_enabled = os.environ.get("DATA_SERVICE_ENABLED", "False")
|
||||
is_enabled = data_service_enabled.lower() == "true"
|
||||
if is_enabled: data_service = DataService.create()
|
||||
data_service_enabled = os.environ.get('DATA_SERVICE_ENABLED', 0)
|
||||
if data_service_enabled: data_service = DataService.create()
|
||||
|
||||
return Application(
|
||||
urls,
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ class TestBasicApp(tornado.testing.AsyncHTTPTestCase):
|
|||
@tornado.testing.gen_test(timeout=_TIMEOUT)
|
||||
def test_report(self):
|
||||
requests = [
|
||||
self.http_client.fetch(self.get_url('/calculator/baseline-model/result')),
|
||||
self.http_client.fetch(self.get_url('/calculator/baseline-model/result'), request_timeout=_TIMEOUT),
|
||||
# At the same time, request a non-report page (to check whether the report is blocking).
|
||||
self.http_client.fetch(self.get_url('/calculator/')),
|
||||
]
|
||||
|
|
@ -69,7 +69,7 @@ class TestCernApp(tornado.testing.AsyncHTTPTestCase):
|
|||
|
||||
@tornado.testing.gen_test(timeout=_TIMEOUT)
|
||||
def test_report(self):
|
||||
response = yield self.http_client.fetch(self.get_url('/calculator/baseline-model/result'))
|
||||
response = yield self.http_client.fetch(self.get_url('/calculator/baseline-model/result'), request_timeout=_TIMEOUT)
|
||||
self.assertEqual(response.code, 200)
|
||||
assert 'expected number of new cases is' in response.body.decode()
|
||||
|
||||
|
|
@ -80,7 +80,7 @@ class TestOpenApp(tornado.testing.AsyncHTTPTestCase):
|
|||
|
||||
@tornado.testing.gen_test(timeout=_TIMEOUT)
|
||||
def test_report(self):
|
||||
response = yield self.http_client.fetch(self.get_url('/mycalc/baseline-model/result'))
|
||||
response = yield self.http_client.fetch(self.get_url('/mycalc/baseline-model/result'), request_timeout=_TIMEOUT)
|
||||
self.assertEqual(response.code, 200)
|
||||
|
||||
def test_calculator_404(self):
|
||||
|
|
|
|||
Loading…
Reference in a new issue