ansible-roles/smartgears/dataminer_app/templates/wps-config-fixer.j2

31 lines
1.1 KiB
Django/Jinja

#!/bin/bash
#
WPS_CONFIG_FILE='{{ smartgears_instance_path }}/webapps/{{ dataminer_wps_name }}/config/wps_config.xml'
# Fix the hostname
{% if hostname is defined %}
sed -Ei 's/hostname=\".*\"\ hostport/hostname="{{ hostname }}" hostport/' $WPS_CONFIG_FILE
{% else %}
sed -Ei 's/hostname=\".*\"\ hostport/hostname="{{ smartgears_hostname }}" hostport/' $WPS_CONFIG_FILE
{% endif %}
# Fix the port
{%if setup_nginx %}
{% if https_port is defined %}
{% if http_redirect_to_https is defined and http_redirect_to_https %}
sed -Ei 's/hostport=\".*\"\ includeDataInputsInResponse/hostport="{{ https_port }}" includeDataInputsInResponse/' $WPS_CONFIG_FILE
{% else %}
sed -Ei 's/hostport=\".*\"\ includeDataInputsInResponse/hostport="{{ http_port }}" includeDataInputsInResponse/' $WPS_CONFIG_FILE
{% endif %}
{% else %}
{%if http_port is defined %}
sed -Ei 's/hostport=\".*\"\ includeDataInputsInResponse/hostport="{{ http_port }}" includeDataInputsInResponse/' $WPS_CONFIG_FILE
{% endif %}
{% endif %}
{% else %}
sed -Ei 's/hostport=\".*\"\ includeDataInputsInResponse/hostport="{{ item.http_port }}" includeDataInputsInResponse/' $WPS_CONFIG_FILE
{% endif %}
exit 0