#
# Copyright © 2016-2026 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.
#

queue_type: "TB_QUEUE_TYPE" #kafka (Apache Kafka)
queue_prefix: "TB_QUEUE_PREFIX"
request_topic: "REMOTE_JS_EVAL_REQUEST_TOPIC"
http_port: "HTTP_PORT"      # /livenessProbe

js:
  response_poll_interval: "REMOTE_JS_RESPONSE_POLL_INTERVAL_MS"
  max_result_size: "JS_MAX_RESULT_SIZE"

kafka:
  bootstrap:
    # Kafka Bootstrap Servers
    servers: "TB_KAFKA_SERVERS"
  replication_factor: "TB_QUEUE_KAFKA_REPLICATION_FACTOR"
  acks: "TB_KAFKA_ACKS" # -1 = all; 0 = no acknowledgments; 1 = only waits for the leader to acknowledge
  batch_size: "TB_KAFKA_BATCH_SIZE" # for producer
  linger_ms: "TB_KAFKA_LINGER_MS" # for producer
  partitions_consumed_concurrently: "TB_KAFKA_PARTITIONS_CONSUMED_CONCURRENTLY" # (EXPERIMENTAL) increase this value if you are planning to handle more than one partition (scale up, scale down) - this will decrease the latency
  requestTimeout: "TB_QUEUE_KAFKA_REQUEST_TIMEOUT_MS"
  connectionTimeout: "TB_KAFKA_CONNECTION_TIMEOUT_MS"
  compression: "TB_QUEUE_KAFKA_COMPRESSION" # gzip, lz4 or none
  topic_properties: "TB_QUEUE_KAFKA_JE_TOPIC_PROPERTIES"
  use_confluent_cloud: "TB_QUEUE_KAFKA_USE_CONFLUENT_CLOUD"
  client_id: "KAFKA_CLIENT_ID" #inject pod name to easy identify the client using /opt/kafka/bin/kafka-consumer-groups.sh
  ssl:
    # Enable or disable SSL for Kafka communication.
    enabled: "TB_KAFKA_SSL_ENABLED"
    # Path to the server certificate file. This file can hold the server certificate or a certificate chain and may include the server private key.
    cert_file: "TB_KAFKA_SSL_PEM_CERTIFICATE"
    # Optional: Path to the server certificate private key file. Required if the private key is not included in the server certificate file.
    key_file: "TB_KAFKA_SSL_PEM_KEY"
    # Optional: Password for the server certificate private key, if applicable.
    key_password: "TB_KAFKA_SSL_PEM_KEY_PASSWORD"
    # Optional: Path to a custom CA certificate file. Defaults to trusting well-known CAs curated by Mozilla.
    ca_file: "TB_KAFKA_SSL_PEM_TRUSTS_CERTIFICATE"
  confluent:
    sasl:
      mechanism: "TB_QUEUE_KAFKA_CONFLUENT_SASL_MECHANISM"
    username: "TB_QUEUE_KAFKA_CONFLUENT_USERNAME"
    password: "TB_QUEUE_KAFKA_CONFLUENT_PASSWORD"
    # Optional: OAuth2 Setting
    oauth:
      # Optional: OAuth2 Client ID
      client_id: "TB_QUEUE_KAFKA_CONFLUENT_OAUTH_CLIENT_ID"
      # Optional: OAuth2 Client Secret
      client_secret: "TB_QUEUE_KAFKA_CONFLUENT_OAUTH_CLIENT_SECRET"
      # Optional: OAuth2 Endpoint URL to get the token from
      endpoint_url: "TB_QUEUE_KAFKA_CONFLUENT_OAUTH_ENDPOINT_URL"
      # Optional: threshold to renew current token before it expires (ms). Token refresh is managed by this service; no equivalent setting exists on the JVM-based services.
      refresh_threshold: "TB_QUEUE_KAFKA_CONFLUENT_OAUTH_REFRESH_THRESHOLD"
      # Optional: OAuth2 scope/audience requested for the token. Required by some IdPs for client-credentials (e.g. Azure AD's "api://<id>/.default")
      scope: "TB_QUEUE_KAFKA_CONFLUENT_OAUTH_SCOPE"

logger:
  level: "LOGGER_LEVEL"
  path: "LOG_FOLDER"
  filename: "LOGGER_FILENAME"

script:
  use_sandbox: "SCRIPT_USE_SANDBOX"
  memory_usage_trace_frequency: "MEMORY_USAGE_TRACE_FREQUENCY"
  stat_print_frequency: "SCRIPT_STAT_PRINT_FREQUENCY"
  script_body_trace_frequency: "SCRIPT_BODY_TRACE_FREQUENCY"
  max_active_scripts: "MAX_ACTIVE_SCRIPTS"
  slow_query_log_ms: "SLOW_QUERY_LOG_MS" #1.123456
  slow_query_log_body: "SLOW_QUERY_LOG_BODY" #true or false
