Class: ChConnect::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/ch_connect/config.rb

Overview

Configuration for ClickHouse connection.

Examples:

config = ChConnect::Config.new(host: "db.example.com", port: 9000)

Using URL

config = ChConnect::Config.new
config.url = "clickhouse://user:pass@localhost:9000/mydb"

Constant Summary collapse

URL_SCHEMES =
{
  "clickhouse" => false,
  "tcp" => false,
  "clickhouses" => true,
  "tcps" => true
}.freeze
DEFAULTS =
{
  host: "localhost",
  port: nil,
  compression: :lz4,
  ssl: false,
  ssl_verify: true,
  ssl_ca: nil,
  database: "default",
  username: "default",
  password: "",
  connection_timeout: 5,
  read_timeout: 60,
  write_timeout: 60,
  keep_alive_timeout: 60,
  pool_size: 100,
  pool_timeout: 5,
  max_retries: 3,
  retry_base_interval: 0.05,
  retry_max_interval: 1.0,
  instrumenter: NullInstrumenter.new
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ Config

Creates a new configuration instance.

Parameters:

  • params (Hash) (defaults to: {})

    configuration options

Options Hash (params):

  • :host (String)

    server hostname (default: "localhost")

  • :port (Integer, nil)

    native endpoint port (default: 9000, or 9440 with TLS)

  • :database (String)

    database name (default: "default")

  • :username (String)

    authentication username (default: "default")

  • :password (String)

    authentication password (default: "")

  • :connection_timeout (Integer)

    connection timeout in seconds (default: 5)

  • :read_timeout (Integer)

    read timeout in seconds (default: 60)

  • :write_timeout (Integer)

    write timeout in seconds (default: 60)

  • :keep_alive_timeout (Numeric, nil)

    pooled TCP connection idle timeout (default: 60)

  • :pool_size (Integer)

    connection pool size (default: 100)

  • :pool_timeout (Integer)

    pool checkout timeout (default: 5)

  • :max_retries (Integer)

    max retries for establishment failures and opted-in idempotent query transport failures (default: 3)

  • :retry_base_interval (Numeric)

    initial retry delay in seconds, with exponential backoff and jitter (default: 0.05)

  • :retry_max_interval (Numeric)

    maximum retry delay in seconds (default: 1.0)



88
89
90
91
92
# File 'lib/ch_connect/config.rb', line 88

def initialize(params = {})
  DEFAULTS.merge(params).each do |key, value|
    send("#{key}=", value)
  end
end

Instance Attribute Details

#compressionString, ...

Returns:

  • (String)

    ClickHouse server hostname

  • (Integer)

    ClickHouse server port

  • (String)

    Database name

  • (String)

    Username for authentication

  • (String)

    Password for authentication

  • (Integer)

    Connection timeout in seconds

  • (Integer)

    Read timeout in seconds

  • (Integer)

    Write timeout in seconds

  • (Numeric, nil)

    Maximum pooled connection idle time in seconds

  • (Integer)

    Connection pool size

  • (Integer)

    Pool checkout timeout in seconds

  • (Integer)

    Max retries for establishment failures and opted-in idempotent query transport failures

  • (Numeric)

    Initial retry delay in seconds; zero disables backoff

  • (Numeric)

    Maximum retry delay in seconds

  • (#instrument)

    Instrumenter for query instrumentation

  • (Integer)

    Native protocol port

  • (Symbol, nil)

    Block compression: :lz4 (default), :zstd or nil

  • (Boolean)

    Use TLS (default: false)

  • (Boolean)

    Verify the server certificate when ssl is enabled (default: true)

  • (String, nil)

    Path to a CA certificate file for TLS verification (default: system CA store)



65
66
67
# File 'lib/ch_connect/config.rb', line 65

def compression
  @compression
end

#connection_timeoutString, ...

Returns:

  • (String)

    ClickHouse server hostname

  • (Integer)

    ClickHouse server port

  • (String)

    Database name

  • (String)

    Username for authentication

  • (String)

    Password for authentication

  • (Integer)

    Connection timeout in seconds

  • (Integer)

    Read timeout in seconds

  • (Integer)

    Write timeout in seconds

  • (Numeric, nil)

    Maximum pooled connection idle time in seconds

  • (Integer)

    Connection pool size

  • (Integer)

    Pool checkout timeout in seconds

  • (Integer)

    Max retries for establishment failures and opted-in idempotent query transport failures

  • (Numeric)

    Initial retry delay in seconds; zero disables backoff

  • (Numeric)

    Maximum retry delay in seconds

  • (#instrument)

    Instrumenter for query instrumentation

  • (Integer)

    Native protocol port

  • (Symbol, nil)

    Block compression: :lz4 (default), :zstd or nil

  • (Boolean)

    Use TLS (default: false)

  • (Boolean)

    Verify the server certificate when ssl is enabled (default: true)

  • (String, nil)

    Path to a CA certificate file for TLS verification (default: system CA store)



65
66
67
# File 'lib/ch_connect/config.rb', line 65

def connection_timeout
  @connection_timeout
end

#databaseString, ...

Returns:

  • (String)

    ClickHouse server hostname

  • (Integer)

    ClickHouse server port

  • (String)

    Database name

  • (String)

    Username for authentication

  • (String)

    Password for authentication

  • (Integer)

    Connection timeout in seconds

  • (Integer)

    Read timeout in seconds

  • (Integer)

    Write timeout in seconds

  • (Numeric, nil)

    Maximum pooled connection idle time in seconds

  • (Integer)

    Connection pool size

  • (Integer)

    Pool checkout timeout in seconds

  • (Integer)

    Max retries for establishment failures and opted-in idempotent query transport failures

  • (Numeric)

    Initial retry delay in seconds; zero disables backoff

  • (Numeric)

    Maximum retry delay in seconds

  • (#instrument)

    Instrumenter for query instrumentation

  • (Integer)

    Native protocol port

  • (Symbol, nil)

    Block compression: :lz4 (default), :zstd or nil

  • (Boolean)

    Use TLS (default: false)

  • (Boolean)

    Verify the server certificate when ssl is enabled (default: true)

  • (String, nil)

    Path to a CA certificate file for TLS verification (default: system CA store)



65
66
67
# File 'lib/ch_connect/config.rb', line 65

def database
  @database
end

#hostString, ...

Returns:

  • (String)

    ClickHouse server hostname

  • (Integer)

    ClickHouse server port

  • (String)

    Database name

  • (String)

    Username for authentication

  • (String)

    Password for authentication

  • (Integer)

    Connection timeout in seconds

  • (Integer)

    Read timeout in seconds

  • (Integer)

    Write timeout in seconds

  • (Numeric, nil)

    Maximum pooled connection idle time in seconds

  • (Integer)

    Connection pool size

  • (Integer)

    Pool checkout timeout in seconds

  • (Integer)

    Max retries for establishment failures and opted-in idempotent query transport failures

  • (Numeric)

    Initial retry delay in seconds; zero disables backoff

  • (Numeric)

    Maximum retry delay in seconds

  • (#instrument)

    Instrumenter for query instrumentation

  • (Integer)

    Native protocol port

  • (Symbol, nil)

    Block compression: :lz4 (default), :zstd or nil

  • (Boolean)

    Use TLS (default: false)

  • (Boolean)

    Verify the server certificate when ssl is enabled (default: true)

  • (String, nil)

    Path to a CA certificate file for TLS verification (default: system CA store)



65
66
67
# File 'lib/ch_connect/config.rb', line 65

def host
  @host
end

#instrumenterString, ...

Returns:

  • (String)

    ClickHouse server hostname

  • (Integer)

    ClickHouse server port

  • (String)

    Database name

  • (String)

    Username for authentication

  • (String)

    Password for authentication

  • (Integer)

    Connection timeout in seconds

  • (Integer)

    Read timeout in seconds

  • (Integer)

    Write timeout in seconds

  • (Numeric, nil)

    Maximum pooled connection idle time in seconds

  • (Integer)

    Connection pool size

  • (Integer)

    Pool checkout timeout in seconds

  • (Integer)

    Max retries for establishment failures and opted-in idempotent query transport failures

  • (Numeric)

    Initial retry delay in seconds; zero disables backoff

  • (Numeric)

    Maximum retry delay in seconds

  • (#instrument)

    Instrumenter for query instrumentation

  • (Integer)

    Native protocol port

  • (Symbol, nil)

    Block compression: :lz4 (default), :zstd or nil

  • (Boolean)

    Use TLS (default: false)

  • (Boolean)

    Verify the server certificate when ssl is enabled (default: true)

  • (String, nil)

    Path to a CA certificate file for TLS verification (default: system CA store)



65
66
67
# File 'lib/ch_connect/config.rb', line 65

def instrumenter
  @instrumenter
end

#keep_alive_timeoutString, ...

Returns:

  • (String)

    ClickHouse server hostname

  • (Integer)

    ClickHouse server port

  • (String)

    Database name

  • (String)

    Username for authentication

  • (String)

    Password for authentication

  • (Integer)

    Connection timeout in seconds

  • (Integer)

    Read timeout in seconds

  • (Integer)

    Write timeout in seconds

  • (Numeric, nil)

    Maximum pooled connection idle time in seconds

  • (Integer)

    Connection pool size

  • (Integer)

    Pool checkout timeout in seconds

  • (Integer)

    Max retries for establishment failures and opted-in idempotent query transport failures

  • (Numeric)

    Initial retry delay in seconds; zero disables backoff

  • (Numeric)

    Maximum retry delay in seconds

  • (#instrument)

    Instrumenter for query instrumentation

  • (Integer)

    Native protocol port

  • (Symbol, nil)

    Block compression: :lz4 (default), :zstd or nil

  • (Boolean)

    Use TLS (default: false)

  • (Boolean)

    Verify the server certificate when ssl is enabled (default: true)

  • (String, nil)

    Path to a CA certificate file for TLS verification (default: system CA store)



65
66
67
# File 'lib/ch_connect/config.rb', line 65

def keep_alive_timeout
  @keep_alive_timeout
end

#max_retriesString, ...

Returns:

  • (String)

    ClickHouse server hostname

  • (Integer)

    ClickHouse server port

  • (String)

    Database name

  • (String)

    Username for authentication

  • (String)

    Password for authentication

  • (Integer)

    Connection timeout in seconds

  • (Integer)

    Read timeout in seconds

  • (Integer)

    Write timeout in seconds

  • (Numeric, nil)

    Maximum pooled connection idle time in seconds

  • (Integer)

    Connection pool size

  • (Integer)

    Pool checkout timeout in seconds

  • (Integer)

    Max retries for establishment failures and opted-in idempotent query transport failures

  • (Numeric)

    Initial retry delay in seconds; zero disables backoff

  • (Numeric)

    Maximum retry delay in seconds

  • (#instrument)

    Instrumenter for query instrumentation

  • (Integer)

    Native protocol port

  • (Symbol, nil)

    Block compression: :lz4 (default), :zstd or nil

  • (Boolean)

    Use TLS (default: false)

  • (Boolean)

    Verify the server certificate when ssl is enabled (default: true)

  • (String, nil)

    Path to a CA certificate file for TLS verification (default: system CA store)



65
66
67
# File 'lib/ch_connect/config.rb', line 65

def max_retries
  @max_retries
end

#passwordString, ...

Returns:

  • (String)

    ClickHouse server hostname

  • (Integer)

    ClickHouse server port

  • (String)

    Database name

  • (String)

    Username for authentication

  • (String)

    Password for authentication

  • (Integer)

    Connection timeout in seconds

  • (Integer)

    Read timeout in seconds

  • (Integer)

    Write timeout in seconds

  • (Numeric, nil)

    Maximum pooled connection idle time in seconds

  • (Integer)

    Connection pool size

  • (Integer)

    Pool checkout timeout in seconds

  • (Integer)

    Max retries for establishment failures and opted-in idempotent query transport failures

  • (Numeric)

    Initial retry delay in seconds; zero disables backoff

  • (Numeric)

    Maximum retry delay in seconds

  • (#instrument)

    Instrumenter for query instrumentation

  • (Integer)

    Native protocol port

  • (Symbol, nil)

    Block compression: :lz4 (default), :zstd or nil

  • (Boolean)

    Use TLS (default: false)

  • (Boolean)

    Verify the server certificate when ssl is enabled (default: true)

  • (String, nil)

    Path to a CA certificate file for TLS verification (default: system CA store)



65
66
67
# File 'lib/ch_connect/config.rb', line 65

def password
  @password
end

#pool_sizeString, ...

Returns:

  • (String)

    ClickHouse server hostname

  • (Integer)

    ClickHouse server port

  • (String)

    Database name

  • (String)

    Username for authentication

  • (String)

    Password for authentication

  • (Integer)

    Connection timeout in seconds

  • (Integer)

    Read timeout in seconds

  • (Integer)

    Write timeout in seconds

  • (Numeric, nil)

    Maximum pooled connection idle time in seconds

  • (Integer)

    Connection pool size

  • (Integer)

    Pool checkout timeout in seconds

  • (Integer)

    Max retries for establishment failures and opted-in idempotent query transport failures

  • (Numeric)

    Initial retry delay in seconds; zero disables backoff

  • (Numeric)

    Maximum retry delay in seconds

  • (#instrument)

    Instrumenter for query instrumentation

  • (Integer)

    Native protocol port

  • (Symbol, nil)

    Block compression: :lz4 (default), :zstd or nil

  • (Boolean)

    Use TLS (default: false)

  • (Boolean)

    Verify the server certificate when ssl is enabled (default: true)

  • (String, nil)

    Path to a CA certificate file for TLS verification (default: system CA store)



65
66
67
# File 'lib/ch_connect/config.rb', line 65

def pool_size
  @pool_size
end

#pool_timeoutString, ...

Returns:

  • (String)

    ClickHouse server hostname

  • (Integer)

    ClickHouse server port

  • (String)

    Database name

  • (String)

    Username for authentication

  • (String)

    Password for authentication

  • (Integer)

    Connection timeout in seconds

  • (Integer)

    Read timeout in seconds

  • (Integer)

    Write timeout in seconds

  • (Numeric, nil)

    Maximum pooled connection idle time in seconds

  • (Integer)

    Connection pool size

  • (Integer)

    Pool checkout timeout in seconds

  • (Integer)

    Max retries for establishment failures and opted-in idempotent query transport failures

  • (Numeric)

    Initial retry delay in seconds; zero disables backoff

  • (Numeric)

    Maximum retry delay in seconds

  • (#instrument)

    Instrumenter for query instrumentation

  • (Integer)

    Native protocol port

  • (Symbol, nil)

    Block compression: :lz4 (default), :zstd or nil

  • (Boolean)

    Use TLS (default: false)

  • (Boolean)

    Verify the server certificate when ssl is enabled (default: true)

  • (String, nil)

    Path to a CA certificate file for TLS verification (default: system CA store)



65
66
67
# File 'lib/ch_connect/config.rb', line 65

def pool_timeout
  @pool_timeout
end

#portObject

Returns the explicitly configured port or the default for the active TLS mode.



96
97
98
# File 'lib/ch_connect/config.rb', line 96

def port
  @port || default_port
end

#read_timeoutString, ...

Returns:

  • (String)

    ClickHouse server hostname

  • (Integer)

    ClickHouse server port

  • (String)

    Database name

  • (String)

    Username for authentication

  • (String)

    Password for authentication

  • (Integer)

    Connection timeout in seconds

  • (Integer)

    Read timeout in seconds

  • (Integer)

    Write timeout in seconds

  • (Numeric, nil)

    Maximum pooled connection idle time in seconds

  • (Integer)

    Connection pool size

  • (Integer)

    Pool checkout timeout in seconds

  • (Integer)

    Max retries for establishment failures and opted-in idempotent query transport failures

  • (Numeric)

    Initial retry delay in seconds; zero disables backoff

  • (Numeric)

    Maximum retry delay in seconds

  • (#instrument)

    Instrumenter for query instrumentation

  • (Integer)

    Native protocol port

  • (Symbol, nil)

    Block compression: :lz4 (default), :zstd or nil

  • (Boolean)

    Use TLS (default: false)

  • (Boolean)

    Verify the server certificate when ssl is enabled (default: true)

  • (String, nil)

    Path to a CA certificate file for TLS verification (default: system CA store)



65
66
67
# File 'lib/ch_connect/config.rb', line 65

def read_timeout
  @read_timeout
end

#retry_base_intervalString, ...

Returns:

  • (String)

    ClickHouse server hostname

  • (Integer)

    ClickHouse server port

  • (String)

    Database name

  • (String)

    Username for authentication

  • (String)

    Password for authentication

  • (Integer)

    Connection timeout in seconds

  • (Integer)

    Read timeout in seconds

  • (Integer)

    Write timeout in seconds

  • (Numeric, nil)

    Maximum pooled connection idle time in seconds

  • (Integer)

    Connection pool size

  • (Integer)

    Pool checkout timeout in seconds

  • (Integer)

    Max retries for establishment failures and opted-in idempotent query transport failures

  • (Numeric)

    Initial retry delay in seconds; zero disables backoff

  • (Numeric)

    Maximum retry delay in seconds

  • (#instrument)

    Instrumenter for query instrumentation

  • (Integer)

    Native protocol port

  • (Symbol, nil)

    Block compression: :lz4 (default), :zstd or nil

  • (Boolean)

    Use TLS (default: false)

  • (Boolean)

    Verify the server certificate when ssl is enabled (default: true)

  • (String, nil)

    Path to a CA certificate file for TLS verification (default: system CA store)



65
66
67
# File 'lib/ch_connect/config.rb', line 65

def retry_base_interval
  @retry_base_interval
end

#retry_max_intervalString, ...

Returns:

  • (String)

    ClickHouse server hostname

  • (Integer)

    ClickHouse server port

  • (String)

    Database name

  • (String)

    Username for authentication

  • (String)

    Password for authentication

  • (Integer)

    Connection timeout in seconds

  • (Integer)

    Read timeout in seconds

  • (Integer)

    Write timeout in seconds

  • (Numeric, nil)

    Maximum pooled connection idle time in seconds

  • (Integer)

    Connection pool size

  • (Integer)

    Pool checkout timeout in seconds

  • (Integer)

    Max retries for establishment failures and opted-in idempotent query transport failures

  • (Numeric)

    Initial retry delay in seconds; zero disables backoff

  • (Numeric)

    Maximum retry delay in seconds

  • (#instrument)

    Instrumenter for query instrumentation

  • (Integer)

    Native protocol port

  • (Symbol, nil)

    Block compression: :lz4 (default), :zstd or nil

  • (Boolean)

    Use TLS (default: false)

  • (Boolean)

    Verify the server certificate when ssl is enabled (default: true)

  • (String, nil)

    Path to a CA certificate file for TLS verification (default: system CA store)



65
66
67
# File 'lib/ch_connect/config.rb', line 65

def retry_max_interval
  @retry_max_interval
end

#sslString, ...

Returns:

  • (String)

    ClickHouse server hostname

  • (Integer)

    ClickHouse server port

  • (String)

    Database name

  • (String)

    Username for authentication

  • (String)

    Password for authentication

  • (Integer)

    Connection timeout in seconds

  • (Integer)

    Read timeout in seconds

  • (Integer)

    Write timeout in seconds

  • (Numeric, nil)

    Maximum pooled connection idle time in seconds

  • (Integer)

    Connection pool size

  • (Integer)

    Pool checkout timeout in seconds

  • (Integer)

    Max retries for establishment failures and opted-in idempotent query transport failures

  • (Numeric)

    Initial retry delay in seconds; zero disables backoff

  • (Numeric)

    Maximum retry delay in seconds

  • (#instrument)

    Instrumenter for query instrumentation

  • (Integer)

    Native protocol port

  • (Symbol, nil)

    Block compression: :lz4 (default), :zstd or nil

  • (Boolean)

    Use TLS (default: false)

  • (Boolean)

    Verify the server certificate when ssl is enabled (default: true)

  • (String, nil)

    Path to a CA certificate file for TLS verification (default: system CA store)



65
66
67
# File 'lib/ch_connect/config.rb', line 65

def ssl
  @ssl
end

#ssl_caString, ...

Returns:

  • (String)

    ClickHouse server hostname

  • (Integer)

    ClickHouse server port

  • (String)

    Database name

  • (String)

    Username for authentication

  • (String)

    Password for authentication

  • (Integer)

    Connection timeout in seconds

  • (Integer)

    Read timeout in seconds

  • (Integer)

    Write timeout in seconds

  • (Numeric, nil)

    Maximum pooled connection idle time in seconds

  • (Integer)

    Connection pool size

  • (Integer)

    Pool checkout timeout in seconds

  • (Integer)

    Max retries for establishment failures and opted-in idempotent query transport failures

  • (Numeric)

    Initial retry delay in seconds; zero disables backoff

  • (Numeric)

    Maximum retry delay in seconds

  • (#instrument)

    Instrumenter for query instrumentation

  • (Integer)

    Native protocol port

  • (Symbol, nil)

    Block compression: :lz4 (default), :zstd or nil

  • (Boolean)

    Use TLS (default: false)

  • (Boolean)

    Verify the server certificate when ssl is enabled (default: true)

  • (String, nil)

    Path to a CA certificate file for TLS verification (default: system CA store)



65
66
67
# File 'lib/ch_connect/config.rb', line 65

def ssl_ca
  @ssl_ca
end

#ssl_verifyString, ...

Returns:

  • (String)

    ClickHouse server hostname

  • (Integer)

    ClickHouse server port

  • (String)

    Database name

  • (String)

    Username for authentication

  • (String)

    Password for authentication

  • (Integer)

    Connection timeout in seconds

  • (Integer)

    Read timeout in seconds

  • (Integer)

    Write timeout in seconds

  • (Numeric, nil)

    Maximum pooled connection idle time in seconds

  • (Integer)

    Connection pool size

  • (Integer)

    Pool checkout timeout in seconds

  • (Integer)

    Max retries for establishment failures and opted-in idempotent query transport failures

  • (Numeric)

    Initial retry delay in seconds; zero disables backoff

  • (Numeric)

    Maximum retry delay in seconds

  • (#instrument)

    Instrumenter for query instrumentation

  • (Integer)

    Native protocol port

  • (Symbol, nil)

    Block compression: :lz4 (default), :zstd or nil

  • (Boolean)

    Use TLS (default: false)

  • (Boolean)

    Verify the server certificate when ssl is enabled (default: true)

  • (String, nil)

    Path to a CA certificate file for TLS verification (default: system CA store)



65
66
67
# File 'lib/ch_connect/config.rb', line 65

def ssl_verify
  @ssl_verify
end

#usernameString, ...

Returns:

  • (String)

    ClickHouse server hostname

  • (Integer)

    ClickHouse server port

  • (String)

    Database name

  • (String)

    Username for authentication

  • (String)

    Password for authentication

  • (Integer)

    Connection timeout in seconds

  • (Integer)

    Read timeout in seconds

  • (Integer)

    Write timeout in seconds

  • (Numeric, nil)

    Maximum pooled connection idle time in seconds

  • (Integer)

    Connection pool size

  • (Integer)

    Pool checkout timeout in seconds

  • (Integer)

    Max retries for establishment failures and opted-in idempotent query transport failures

  • (Numeric)

    Initial retry delay in seconds; zero disables backoff

  • (Numeric)

    Maximum retry delay in seconds

  • (#instrument)

    Instrumenter for query instrumentation

  • (Integer)

    Native protocol port

  • (Symbol, nil)

    Block compression: :lz4 (default), :zstd or nil

  • (Boolean)

    Use TLS (default: false)

  • (Boolean)

    Verify the server certificate when ssl is enabled (default: true)

  • (String, nil)

    Path to a CA certificate file for TLS verification (default: system CA store)



65
66
67
# File 'lib/ch_connect/config.rb', line 65

def username
  @username
end

#write_timeoutString, ...

Returns:

  • (String)

    ClickHouse server hostname

  • (Integer)

    ClickHouse server port

  • (String)

    Database name

  • (String)

    Username for authentication

  • (String)

    Password for authentication

  • (Integer)

    Connection timeout in seconds

  • (Integer)

    Read timeout in seconds

  • (Integer)

    Write timeout in seconds

  • (Numeric, nil)

    Maximum pooled connection idle time in seconds

  • (Integer)

    Connection pool size

  • (Integer)

    Pool checkout timeout in seconds

  • (Integer)

    Max retries for establishment failures and opted-in idempotent query transport failures

  • (Numeric)

    Initial retry delay in seconds; zero disables backoff

  • (Numeric)

    Maximum retry delay in seconds

  • (#instrument)

    Instrumenter for query instrumentation

  • (Integer)

    Native protocol port

  • (Symbol, nil)

    Block compression: :lz4 (default), :zstd or nil

  • (Boolean)

    Use TLS (default: false)

  • (Boolean)

    Verify the server certificate when ssl is enabled (default: true)

  • (String, nil)

    Path to a CA certificate file for TLS verification (default: system CA store)



65
66
67
# File 'lib/ch_connect/config.rb', line 65

def write_timeout
  @write_timeout
end

Instance Method Details

#url=(url) ⇒ void

This method returns an undefined value.

Sets configuration from a URL string.

Parameters:

  • url (String)

    ClickHouse connection URL



104
105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/ch_connect/config.rb', line 104

def url=(url)
  uri = URI(url)
  ssl = URL_SCHEMES.fetch(uri.scheme) do
    raise ArgumentError, "unsupported ClickHouse URL scheme: #{uri.scheme.inspect}"
  end

  @ssl = ssl
  @port = uri.port
  @host = uri.host
  database = uri.path.delete_prefix("/")
  @database = database unless database.empty?
  @username = uri.user if uri.user
  @password = uri.password if uri.password
end