[package]
name = "bgpkit-broker"
version = "0.10.0"
edition = "2021"
authors = ["Mingwei Zhang <mingwei@bgpkit.com>"]
readme = "README.md"
license = "MIT"
repository = "https://github.com/bgpkit/bgpkit-broker"
documentation = "https://docs.rs/bgpkit-broker"
description = """
A library and command-line to provide indexing and searching functionalities for public BGP data archive files over time.
"""
keywords = ["bgp", "bgpkit", "api"]

[[bin]]
path = "src/cli/main.rs"
name = "bgpkit-broker"
required-features = ["cli"]

[dependencies]

#############################################
# Core Broker Rust SDK dependencies
#############################################
chrono = { version = "0.4", features = ["serde"] }
log = "0.4"
reqwest = { version = "0.12", default-features = false, features = [
    "blocking",
    "json",
    "stream",
    "rustls-tls-native-roots",
] }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
thiserror = "2.0"
tracing = "0.1"
lazy_static = "1"
dotenvy = "0.15"

#############################################
# Optional dependencies
#############################################

# command-line interface dependencies
clap = { version = "4.3", features = ["derive"], optional = true }
dirs = { version = "6", optional = true }
humantime = { version = "2.1", optional = true }
num_cpus = { version = "1.15", optional = true }
tabled = { version = "0.20.0", optional = true }
tracing-subscriber = { version = "0.3", optional = true }
indicatif = { version = "0.18.0", optional = true }
futures-util = { version = "0.3.28", optional = true }
itertools = { version = "0.14.0", optional = true }
tempfile = { version = "3.8", optional = true }
which = { version = "8.0.0", optional = true }
bgpkit-commons = { version = "0.9.2", default-features = false, features = ["mrt_collectors", "countries"], optional = true }

# crawler dependencies
futures = { version = "0.3", optional = true }
oneio = { version = "0.20.0", default-features = false, features = ["https", "s3"], optional = true }
regex = { version = "1", optional = true }
scraper = { version = "0.24", optional = true }
tokio = { version = "1", optional = true, features = ["full"] }

# api dependencies
axum = { version = "0.8", optional = true }
tower-http = { version = "0.6", optional = true, features = ["cors"] }
http = { version = "1.0", optional = true }
axum-prometheus = { version = "0.9.0", optional = true }

# database dependencies
sqlx = { version = "0.8", features = [
    "runtime-tokio",
    "sqlite",
], optional = true }
async-nats = { version = "0.42.0", optional = true }

[features]
default = []
cli = [
    # command-line interface
    "clap",
    "dirs",
    "humantime",
    "num_cpus",
    "tracing-subscriber",
    "tabled",
    "itertools",
    "tempfile",
    "which",
    "bgpkit-commons",
    # crawler
    "futures",
    "oneio",
    "regex",
    "scraper",
    "tokio",
    # notification
    "nats",
    # database
    "backend",
    # bootstrap
    "indicatif",
    "futures-util",
    # API
    "axum",
    "axum-prometheus",
    "http",
    "tower-http",
]
backend = ["tokio", "sqlx"]

# notification features
nats = ["async-nats"]

[dev-dependencies]
tracing-subscriber = "0.3.17"

[package.metadata.binstall]
pkg-url = "{ repo }/releases/download/v{ version }/{ name }-{ target }.tar.gz"
pkg-fmt = "tgz"

[lints.clippy]
uninlined_format_args = "allow"
unwrap_used = "deny"