Commit 02874323 by Fred Smith

reduce number of if statements

parent 385273fd
...@@ -6,11 +6,7 @@ ...@@ -6,11 +6,7 @@
{% if COMMON_ENABLE_NEWRELIC_APP %} {% if COMMON_ENABLE_NEWRELIC_APP %}
{% set executable = edxapp_venv_bin + '/newrelic-admin run-program ' + edxapp_venv_bin + '/gunicorn' %} {% set executable = edxapp_venv_bin + '/newrelic-admin run-program ' + edxapp_venv_bin + '/gunicorn' %}
{% else %}
{% set executable = edxapp_venv_bin + '/gunicorn' %}
{% endif %}
{% if COMMON_ENABLE_NEWRELIC_APP %}
export NEW_RELIC_APP_NAME="{{ EDXAPP_NEWRELIC_CMS_APPNAME }}" export NEW_RELIC_APP_NAME="{{ EDXAPP_NEWRELIC_CMS_APPNAME }}"
export NEW_RELIC_CONFIG_FILE="{{ edxapp_app_dir }}/newrelic.ini" export NEW_RELIC_CONFIG_FILE="{{ edxapp_app_dir }}/newrelic.ini"
if command -v ec2metadata >/dev/null 2>&1; then if command -v ec2metadata >/dev/null 2>&1; then
...@@ -19,7 +15,10 @@ if command -v ec2metadata >/dev/null 2>&1; then ...@@ -19,7 +15,10 @@ if command -v ec2metadata >/dev/null 2>&1; then
export NEW_RELIC_PROCESS_HOST_DISPLAY_NAME="$HOSTNAME-$INSTANCEID" export NEW_RELIC_PROCESS_HOST_DISPLAY_NAME="$HOSTNAME-$INSTANCEID"
fi fi
export NEW_RELIC_LICENSE_KEY="{{ NEWRELIC_LICENSE_KEY }}" export NEW_RELIC_LICENSE_KEY="{{ NEWRELIC_LICENSE_KEY }}"
{% endif -%}
{% else %}
{% set executable = edxapp_venv_bin + '/gunicorn' %}
{% endif %}
export PORT="{{ edxapp_cms_gunicorn_port }}" export PORT="{{ edxapp_cms_gunicorn_port }}"
export ADDRESS="{{ edxapp_cms_gunicorn_host }}" export ADDRESS="{{ edxapp_cms_gunicorn_host }}"
......
...@@ -6,11 +6,7 @@ ...@@ -6,11 +6,7 @@
{% if COMMON_ENABLE_NEWRELIC_APP %} {% if COMMON_ENABLE_NEWRELIC_APP %}
{% set executable = edxapp_venv_bin + '/newrelic-admin run-program ' + edxapp_venv_bin + '/gunicorn' %} {% set executable = edxapp_venv_bin + '/newrelic-admin run-program ' + edxapp_venv_bin + '/gunicorn' %}
{% else %}
{% set executable = edxapp_venv_bin + '/gunicorn' %}
{% endif %}
{% if COMMON_ENABLE_NEWRELIC_APP %}
export NEW_RELIC_APP_NAME="{{ EDXAPP_NEWRELIC_LMS_APPNAME }}" export NEW_RELIC_APP_NAME="{{ EDXAPP_NEWRELIC_LMS_APPNAME }}"
export NEW_RELIC_CONFIG_FILE="{{ edxapp_app_dir }}/newrelic.ini" export NEW_RELIC_CONFIG_FILE="{{ edxapp_app_dir }}/newrelic.ini"
if command -v ec2metadata >/dev/null 2>&1; then if command -v ec2metadata >/dev/null 2>&1; then
...@@ -19,6 +15,10 @@ if command -v ec2metadata >/dev/null 2>&1; then ...@@ -19,6 +15,10 @@ if command -v ec2metadata >/dev/null 2>&1; then
export NEW_RELIC_PROCESS_HOST_DISPLAY_NAME="$HOSTNAME-$INSTANCEID" export NEW_RELIC_PROCESS_HOST_DISPLAY_NAME="$HOSTNAME-$INSTANCEID"
fi fi
export NEW_RELIC_LICENSE_KEY="{{ NEWRELIC_LICENSE_KEY }}" export NEW_RELIC_LICENSE_KEY="{{ NEWRELIC_LICENSE_KEY }}"
{% else %}
{% set executable = edxapp_venv_bin + '/gunicorn' %}
{% endif -%} {% endif -%}
export PORT="{{ edxapp_lms_gunicorn_port }}" export PORT="{{ edxapp_lms_gunicorn_port }}"
......
...@@ -5,17 +5,14 @@ ...@@ -5,17 +5,14 @@
{% set edxapp_venv_bin = edxapp_venv_dir + "/bin" %} {% set edxapp_venv_bin = edxapp_venv_dir + "/bin" %}
{% if COMMON_ENABLE_NEWRELIC_APP %} {% if COMMON_ENABLE_NEWRELIC_APP %}
{% set executable = edxapp_venv_bin + '/newrelic-admin run-program ' + edxapp_venv_bin + '/python' %} {% set executable = edxapp_venv_bin + '/newrelic-admin run-program ' + edxapp_venv_bin + '/python' %}
{% else %}
{% set executable = edxapp_venv_bin + '/python' %}
{% endif %}
{% if COMMON_ENABLE_NEWRELIC_APP %}
export NEW_RELIC_CONFIG_FILE="{{ edxapp_app_dir }}/newrelic.ini" export NEW_RELIC_CONFIG_FILE="{{ edxapp_app_dir }}/newrelic.ini"
if command -v ec2metadata >/dev/null 2>&1; then if command -v ec2metadata >/dev/null 2>&1; then
INSTANCEID=$(ec2metadata --instance-id); INSTANCEID=$(ec2metadata --instance-id);
HOSTNAME=$(hostname) HOSTNAME=$(hostname)
export NEW_RELIC_PROCESS_HOST_DISPLAY_NAME="$HOSTNAME-$INSTANCEID" export NEW_RELIC_PROCESS_HOST_DISPLAY_NAME="$HOSTNAME-$INSTANCEID"
fi fi
{% endif -%} {% else %}
{% set executable = edxapp_venv_bin + '/python' %}
{% endif %}
{{ executable }} {{ edxapp_code_dir }}/manage.py $@ {{ executable }} {{ edxapp_code_dir }}/manage.py $@
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment