#
# Copyright © 2016-2018 The Thingsboard Authors
#
# 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.
#

spring.main.web-application-type: none

# MQTT server parameters
mqtt:
  # Enable/disable mqtt transport protocol.
  enabled: "${MQTT_ENABLED:true}"
  bind_address: "${MQTT_BIND_ADDRESS:0.0.0.0}"
  bind_port: "${MQTT_BIND_PORT:1883}"
  adaptor: "${MQTT_ADAPTOR_NAME:JsonMqttAdaptor}"
  timeout: "${MQTT_TIMEOUT:10000}"
  netty:
    leak_detector_level: "${NETTY_LEASK_DETECTOR_LVL:DISABLED}"
    boss_group_thread_count: "${NETTY_BOSS_GROUP_THREADS:1}"
    worker_group_thread_count: "${NETTY_WORKER_GROUP_THREADS:12}"
    max_payload_size: "${NETTY_MAX_PAYLOAD_SIZE:65536}"
  # MQTT SSL configuration
  ssl:
    # Enable/disable SSL support
    enabled: "${MQTT_SSL_ENABLED:false}"
    # SSL protocol: See http://docs.oracle.com/javase/8/docs/technotes/guides/security/StandardNames.html#SSLContext
    protocol: "${MQTT_SSL_PROTOCOL:TLSv1.2}"
    # Path to the key store that holds the SSL certificate
    key_store: "${MQTT_SSL_KEY_STORE:mqttserver.jks}"
    # Password used to access the key store
    key_store_password: "${MQTT_SSL_KEY_STORE_PASSWORD:server_ks_password}"
    # Password used to access the key
    key_password: "${MQTT_SSL_KEY_PASSWORD:server_key_password}"
    # Type of the key store
    key_store_type: "${MQTT_SSL_KEY_STORE_TYPE:JKS}"

#Quota parameters
quota:
  host:
    # Max allowed number of API requests in interval for single host
    limit: "${QUOTA_HOST_LIMIT:10000}"
    # Interval duration
    intervalMs: "${QUOTA_HOST_INTERVAL_MS:60000}"
    # Maximum silence duration for host after which Host removed from QuotaService. Must be bigger than intervalMs
    ttlMs: "${QUOTA_HOST_TTL_MS:60000}"
    # Interval for scheduled task that cleans expired records. TTL is used for expiring
    cleanPeriodMs: "${QUOTA_HOST_CLEAN_PERIOD_MS:300000}"
    # Enable Host API Limits
    enabled: "${QUOTA_HOST_ENABLED:false}"
    # Array of whitelist hosts
    whitelist: "${QUOTA_HOST_WHITELIST:localhost,127.0.0.1}"
    # Array of blacklist hosts
    blacklist: "${QUOTA_HOST_BLACKLIST:}"
    log:
      topSize: 10
      intervalMin: 2

kafka:
  enabled: true
  bootstrap.servers: "${TB_KAFKA_SERVERS:localhost:9092}"
  acks: "${TB_KAFKA_ACKS:all}"
  retries: "${TB_KAFKA_RETRIES:1}"
  batch.size: "${TB_KAFKA_BATCH_SIZE:16384}"
  linger.ms: "${TB_KAFKA_LINGER_MS:1}"
  buffer.memory: "${TB_BUFFER_MEMORY:33554432}"
  transport_api:
    requests_topic: "${TB_TRANSPORT_API_REQUEST_TOPIC:tb.transport.api.requests}"
    responses_topic: "${TB_TRANSPORT_API_RESPONSE_TOPIC:tb.transport.api.responses}"
    max_pending_requests: "${TB_TRANSPORT_MAX_PENDING_REQUESTS:10000}"
    max_requests_timeout: "${TB_TRANSPORT_MAX_REQUEST_TIMEOUT:10000}"
    response_poll_interval: "${TB_TRANSPORT_RESPONSE_POLL_INTERVAL_MS:25}"
    response_auto_commit_interval: "${TB_TRANSPORT_RESPONSE_AUTO_COMMIT_INTERVAL_MS:100}"
  rule_engine:
    topic: "${TB_RULE_ENGINE_TOPIC:tb.rule-engine}"
  notifications:
    topic: "${TB_TRANSPORT_NOTIFICATIONS_TOPIC:tb.transport.notifications}"
    poll_interval: "${TB_TRANSPORT_NOTIFICATIONS_POLL_INTERVAL_MS:25}"
    auto_commit_interval: "${TB_TRANSPORT_NOTIFICATIONS_AUTO_COMMIT_INTERVAL_MS:100}"
