[http]
host = "0.0.0.0"
port = 8080
root_url = "http://cdviz-collector.example.com"

[pipeline]
queue_capacity = 1024

[state]
kind = "fs"

[state.parameters]
root = "./.cdviz-collector/state"

[sinks.debug]
enabled = false
type = "debug"

[sinks.cdevents_local_json]
enabled = false
type = "folder"
kind = "fs"
parameters = { root = "./sink" }

[sinks.database]
enabled = false
type = "db"
url = "postgresql://postgres:passwd@localhost:5432/cdviz?search_path=cdviz"
pool_connections_min = 0
pool_connections_max = 10
pool_acquire_timeout = "30s"
pool_idle_timeout = "10m"
pool_max_lifetime = "30m"
pool_test_before_acquire = true
lazy_connection = false

# [sinks.clickhouse]
# enabled = false
# type = "clickhouse"
# url = "http://localhost:8123"
# database = "default"
# # user = "default"
# # password = ""
# # Query template with {field} placeholders - customize based on your table schema
# query = "INSERT INTO cdevents_lake (id, type, source, subject, predicate, specversion, timestamp, payload) VALUES ({id}, {type}, {source}, {subject}, {predicate}, {specversion}, {timestamp}, {payload})"

[sources.cdevents_local_json]
enabled = false

[sources.cdevents_local_json.extractor]
type = "opendal"
kind = "fs"
polling_interval = "10s"
parameters = { root = "./source" }
recursive = true
path_patterns = ["**/*.json"]
parser = "json"

[sources.cdevents_webhook]
enabled = false

[sources.cdevents_webhook.extractor]
type = "webhook"
id = "000"
# headers_to_keep = []

[transformers.passthrough]
type = "passthrough"

[transformers.log]
type = "log"
target = "transformers::log"

[transformers.discard_all]
type = "discard_all"

[transformers.deduplicate_on_context_id]
type = "deduplicate"
capacity = 10
key_path = "/context/id"
