#!/bin/bash

# Settings needed for the Sahara plugin
# -------------------------------------

# Set up default directories
SAHARACLIENT_DIR=$DEST/python-saharaclient
SAHARA_DIR=$DEST/sahara
AMBARI_PLUGIN_DIR=$DEST/sahara-plugin-ambari
CDH_PLUGIN_DIR=$DEST/sahara-plugin-cdh
MAPR_PLUGIN_DIR=$DEST/sahara-plugin-mapr
SPARK_PLUGIN_DIR=$DEST/sahara-plugin-spark
STORM_PLUGIN_DIR=$DEST/sahara-plugin-storm
VANILLA_PLUGIN_DIR=$DEST/sahara-plugin-vanilla

SAHARACLIENT_REPO=${SAHARACLIENT_REPO:-\
${GIT_BASE}/openstack/python-saharaclient.git}
SAHARACLIENT_BRANCH=${SAHARACLIENT_BRANCH:-master}
AMBARI_PLUGIN_REPO=${AMBARI_PLUGIN_REPO:-https://opendev.org/openstack/sahara-plugin-ambari/}
AMBARI_PLUGIN_BRANCH=${AMBARI_PLUGIN_BRANCH:-master}
CDH_PLUGIN_REPO=${CDH_PLUGIN_REPO:-https://opendev.org/openstack/sahara-plugin-cdh/}
CDH_PLUGIN_BRANCH=${CDH_PLUGIN_BRANCH:-master}
MAPR_PLUGIN_REPO=${MAPR_PLUGIN_REPO:-https://opendev.org/openstack/sahara-plugin-mapr/}
MAPR_PLUGIN_BRANCH=${MAPR_PLUGIN_BRANCH:-master}
SPARK_PLUGIN_REPO=${SPARK_PLUGIN_REPO:-https://opendev.org/openstack/sahara-plugin-spark/}
SPARK_PLUGIN_BRANCH=${SPARK_PLUGIN_BRANCH:-master}
STORM_PLUGIN_REPO=${STORM_PLUGIN_REPO:-https://opendev.org/openstack/sahara-plugin-storm/}
STORM_PLUGIN_BRANCH=${STORM_PLUGIN_BRANCH:-master}
VANILLA_PLUGIN_REPO=${VANILLA_PLUGIN_REPO:-https://opendev.org/openstack/sahara-plugin-vanilla/}
VANILLA_PLUGIN_BRANCH=${VANILLA_PLUGIN_BRANCH:-master}


SAHARA_CONF_DIR=${SAHARA_CONF_DIR:-/etc/sahara}
SAHARA_CONF_FILE=${SAHARA_CONF_DIR}/sahara.conf

# TODO(slukjanov): Should we append sahara to SSL_ENABLED_SERVICES?

if is_ssl_enabled_service "sahara" || is_service_enabled tls-proxy; then
    SAHARA_SERVICE_PROTOCOL="https"
fi
SAHARA_SERVICE_HOST=${SAHARA_SERVICE_HOST:-$SERVICE_HOST}
SAHARA_SERVICE_PORT=${SAHARA_SERVICE_PORT:-8386}
SAHARA_SERVICE_PORT_INT=${SAHARA_SERVICE_PORT_INT:-18386}
SAHARA_SERVICE_PROTOCOL=${SAHARA_SERVICE_PROTOCOL:-$SERVICE_PROTOCOL}
SAHARA_ENDPOINT_TYPE=${SAHARA_ENDPOINT_TYPE:-publicURL}

SAHARA_ENABLED_PLUGINS=${SAHARA_ENABLED_PLUGINS:-\
vanilla,ambari,cdh,mapr,spark,storm,fake}
SAHARA_INSTALLED_PLUGINS=${SAHARA_INSTALLED_PLUGINS:-\
vanilla,ambari,cdh,mapr,spark,storm,fake}
SAHARA_BIN_DIR=$(get_python_exec_prefix)

SAHARA_ENABLE_DISTRIBUTED_PERIODICS=${SAHARA_ENABLE_DISTRIBUTED_PERIODICS:-\
True}
SAHARA_PERIODIC_COORDINATOR_URL=${SAHARA_PERIODIC_COORDINATOR_URL:-\
memcached://127.0.0.1:11211}

#Toggle for deploying Sahara API with Apache + mod_wsgi
SAHARA_USE_MOD_WSGI=${SAHARA_USE_MOD_WSGI:-True}

enable_service sahara-api sahara-eng
enable_service heat h-eng h-api h-api-cfn h-api-cw
