Configuration for a ClickHouse gRPC connection pool.
Supports both password and JWT authentication methods. A config is built with
new/1 and started as a pool with Huginn.child_spec/1 (or
Huginn.Clickhouse.Pool), which registers it under its :pool_name so that
queries routed to that pool use its database and credentials.
The :auth field is excluded from inspect/2 output so credentials never
end up in logs or crash reports.
Examples
# Password authentication
config = Huginn.Clickhouse.Config.new(
host: "localhost",
port: 9100,
database: "default",
auth: {:password, "default", "secret"}
)
# JWT authentication
config = Huginn.Clickhouse.Config.new(
host: "localhost",
port: 9100,
database: "default",
auth: {:jwt, "eyJ..."}
)
Summary
Functions
Extracts authentication credentials for query building.
Returns the name of the default pool: the :pool_name of the
:huginn, :clickhouse application config, or :clickhouse_pool.
Returns the config registered for pool_name by Huginn.Clickhouse.Pool.
Creates a new config struct from a keyword list or a map.
Converts config to GrpcConnectionPool keyword list format.
Types
Functions
Extracts authentication credentials for query building.
@spec default_pool() :: atom()
Returns the name of the default pool: the :pool_name of the
:huginn, :clickhouse application config, or :clickhouse_pool.
@spec fetch(atom()) :: {:ok, t()} | {:error, Huginn.Error.t()}
Returns the config registered for pool_name by Huginn.Clickhouse.Pool.
Creates a new config struct from a keyword list or a map.
Raises ArgumentError when an option is missing, unknown or invalid. Error
messages name the offending option but never include option values, so
credentials cannot leak through a configuration error.
Options
:host- ClickHouse server host (required):port- gRPC port (default: 9100):database- Default database for queries on this pool (default: "default"):auth- Authentication tuple:{:password, user, pass}or{:jwt, token}:pool_size- Connection pool size (default: 5):pool_name- Pool name for registration (default: :clickhouse_pool):ssl-false(default) for plaintext h2c,trueto enable TLS with peer verification against the system CA store, or a keyword list of:ssloptions (e.g.[cacertfile: "/ca.pem"]) for custom CAs or client certificates. A keyword list without:verifygetsverify: :verify_peer, the system CA store (unless:cacerts/:cacertfileis given) and HTTPS hostname checking merged underneath it; your keys always win. Passverify: :verify_noneexplicitly to opt out of verification.
Examples
Huginn.Clickhouse.Config.new(host: "localhost")
Huginn.Clickhouse.Config.new(%{host: "localhost", database: "analytics"})
Converts config to GrpcConnectionPool keyword list format.
Raises ArgumentError when ssl: true cannot produce a peer-verifying TLS
configuration on the running OTP release.