#
# Copyright 2017 FUJITSU LIMITED
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

# Monasca infrastructure services
enable_service monasca-zookeeper
enable_service monasca-kafka
enable_service monasca-elasticsearch


# Monasca Events services
enable_service monasca-events
enable_service monasca-events-api
enable_service monasca-events-persister
enable_service monasca-events-agent


# Dependent Software Versions
BASE_KAFKA_VERSION=${BASE_KAFKA_VERSION:-0.9.0.1}
SCALA_VERSION=${SCALA_VERSION:-2.11}
KAFKA_VERSION=${KAFKA_VERSION:-${SCALA_VERSION}-${BASE_KAFKA_VERSION}}
ELASTICSEARCH_VERSION=${ELASTICSEARCH_VERSION:-2.4.2}


# Path settings
MONASCA_BASE=${DEST}

# Repository settings
MONASCA_EVENTS_API_REPO=${MONASCA_EVENTS_API_REPO:-${GIT_BASE}/openstack/monasca-events-api.git}
MONASCA_EVENTS_API_BRANCH=${MONASCA_EVENTS_API_BRANCH:-master}
MONASCA_EVENTS_API_DIR=${MONASCA_BASE}/monasca-events-api

MONASCA_EVENTS_PERSISTER_REPO=${MONASCA_EVENTS_PERSISTER_REPO:-${GIT_BASE}/openstack/monasca-persister.git}
MONASCA_EVENTS_PERSISTER_BRANCH=${MONASCA_EVENTS_PERSISTER_BRANCH:-master}
MONASCA_EVENTS_PERSISTER_DIR=${MONASCA_BASE}/monasca-persister

MONASCA_EVENTS_AGENT_REPO=${MONASCA_EVENTS_AGENT_REPO:-${GIT_BASE}/openstack/monasca-events-agent.git}
MONASCA_EVENTS_AGENT_BRANCH=${MONASCA_EVENTS_AGENT_BRANCH:-master}
MONASCA_EVENTS_AGENT_DIR=${MONASCA_BASE}/monasca-events-agent

# Dependencies settings
ELASTICSEARCH_BIND_HOST=${ELASTICSEARCH_BIND_HOST:-${SERVICE_HOST}}
ELASTICSEARCH_BIND_PORT=${ELASTICSEARCH_BIND_PORT:-9200}
ELASTICSEARCH_PUBLISH_HOST=${ELASTICSEARCH_PUBLISH_HOST:-${SERVICE_HOST}}
ELASTICSEARCH_PUBLISH_PORT=${ELASTICSEARCH_PUBLISH_PORT:-9300}
ELASTICSEARCH_DIR=$DEST/elasticsearch
ELASTICSEARCH_CFG_DIR=$ELASTICSEARCH_DIR/config
ELASTICSEARCH_LOG_DIR=$LOGDIR/elasticsearch
ELASTICSEARCH_DATA_DIR=$DATA_DIR/elasticsearch

KAFKA_SERVICE_HOST=${KAFKA_SERVICE_HOST:-${SERVICE_HOST}}
KAFKA_SERVICE_PORT=${KAFKA_SERVICE_PORT:-9092}
# Apache Kafka 0.9.0.1 is only available in Apache Archives
APACHE_ARCHIVES=${APACHE_ARCHIVES:-"https://archive.apache.org/dist/"}

# configuration
MONASCA_EVENTS_LOG_DIR=${MONASCA_EVENTS_LOG_DIR:-/var/log/monasca}
MONASCA_EVENTS_DEVSTACK_DIR=${MONASCA_EVENTS_DEVSTACK_DIR:-$MONASCA_EVENTS_API_DIR/devstack}

MONASCA_EVENTS_API_CONF_DIR=${MONASCA_EVENTS_API_CONF_DIR:-/etc/monasca}
MONASCA_EVENTS_API_CONF=${MONASCA_EVENTS_API_CONF:-$MONASCA_EVENTS_API_CONF_DIR/events-api.conf}
MONASCA_EVENTS_API_PASTE=${MONASCA_EVENTS_API_PASTE:-$MONASCA_EVENTS_API_CONF_DIR/events-api-paste.ini}
MONASCA_EVENTS_API_LOGGING_CONF=${MONASCA_EVENTS_API_LOGGING_CONF:-$MONASCA_EVENTS_API_CONF_DIR/events-api-logging.conf}
MONASCA_EVENTS_API_CACHE_DIR=${MONASCA_EVENTS_API_CACHE_DIR:-/var/cache/monasca-events-api}
MONASCA_EVENTS_API_SERVICE_HOST=${MONASCA_EVENTS_API_SERVICE_HOST:-${SERVICE_HOST}}
MONASCA_EVENTS_API_SERVICE_PORT=${MONASCA_EVENTS_API_SERVICE_PORT:-5656}
MONASCA_EVENTS_API_SERVICE_PROTOCOL=${MONASCA_EVENTS_API_SERVICE_PROTOCOL:-${SERVICE_PROTOCOL}}
MONASCA_EVENTS_API_UWSGI_CONF=${MONASCA_EVENTS_API_UWSGI_CONF:-$MONASCA_EVENTS_API_CONF_DIR/events-api-uwsgi.ini}

MONASCA_EVENTS_PERSISTER_CONF_DIR=${MONASCA_EVENTS_PERSISTER_CONF_DIR:-/etc/monasca}
MONASCA_EVENTS_PERSISTER_CONF=${MONASCA_EVENTS_PERSISTER_CONF:-${MONASCA_EVENTS_PERSISTER_CONF_DIR}/events-persister.conf}
MONASCA_EVENTS_PERSISTER_LOGGING_CONF=${MONASCA_EVENTS_PERSISTER_LOGGING_CONF:-${MONASCA_EVENTS_PERSISTER_CONF_DIR}/events-persister-logging.conf}


# Other settings
PLUGIN_FILES=$MONASCA_EVENTS_API_DIR/devstack/files
DOWNLOAD_FILE_TIMEOUT=${DOWNLOAD_FILE_TIMEOUT:-300}
