Huginn.Clickhouse.Config (Huginn v0.4.0)

View Source

Configuration for ClickHouse gRPC connections.

Supports both password and JWT authentication methods.

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.

Loads configuration from application environment.

Creates a new config struct from keyword options.

Converts config to GrpcConnectionPool keyword list format.

Types

auth()

@type auth() :: {:password, String.t(), String.t()} | {:jwt, String.t()}

t()

@type t() :: %Huginn.Clickhouse.Config{
  auth: auth() | nil,
  compression: String.t() | nil,
  database: String.t(),
  host: String.t(),
  pool_name: atom(),
  pool_size: non_neg_integer(),
  port: non_neg_integer(),
  ssl: boolean()
}

Functions

auth_opts(config)

@spec auth_opts(t()) :: keyword()

Extracts authentication credentials for query building.

from_env()

@spec from_env() :: t()

Loads configuration from application environment.

Expects config under :huginn, :clickhouse key.

Example config

config :huginn, :clickhouse,
  host: "localhost",
  port: 9100,
  database: "default",
  auth: {:password, "default", ""}

new(opts)

@spec new(keyword()) :: t()

Creates a new config struct from keyword options.

Options

  • :host - ClickHouse server host (required)
  • :port - gRPC port (default: 9100)
  • :database - Default database (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 - Enable SSL/TLS (default: false)
  • :compression - Output compression type: "gzip", "lz4", "zstd", etc.

to_pool_config(config)

@spec to_pool_config(t()) :: keyword()

Converts config to GrpcConnectionPool keyword list format.