handled environment variables to be consistent

This commit is contained in:
Luis Aleixo 2024-03-05 16:54:08 +01:00
parent e0c2e959a2
commit c8cc0b0908
5 changed files with 15 additions and 9 deletions

View file

@ -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

View file

@ -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[@]}"

View file

@ -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:

View file

@ -284,7 +284,9 @@
key: ARVE_API_KEY
name: arve-api
- name: DATA_SERVICE_ENABLED
value: 'True'
value: '1'
- 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: '1'
- name: CAIMIRA_PROFILER_ENABLED
value: '1'
image: '${PROJECT_NAME}/calculator-app'
ports:
- containerPort: 8080

View file

@ -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,