Class: ChConnect::Config
- Inherits:
-
Object
- Object
- ChConnect::Config
- Defined in:
- lib/ch_connect/config.rb
Overview
Configuration for ClickHouse connection.
Constant Summary collapse
- DEFAULTS =
{ scheme: "http", host: "localhost", port: 8123, database: "default", username: "", password: "", connection_timeout: 5, read_timeout: 60, write_timeout: 60, keep_alive_timeout: 8, pool_size: 100, pool_timeout: 5, max_retries: 3, instrumenter: NullInstrumenter.new }.freeze
Instance Attribute Summary collapse
- #connection_timeout ⇒ String, ...
- #database ⇒ String, ...
- #host ⇒ String, ...
- #instrumenter ⇒ String, ...
- #keep_alive_timeout ⇒ String, ...
- #max_retries ⇒ String, ...
- #password ⇒ String, ...
- #pool_size ⇒ String, ...
- #pool_timeout ⇒ String, ...
- #port ⇒ String, ...
- #read_timeout ⇒ String, ...
- #scheme ⇒ String, ...
- #username ⇒ String, ...
- #write_timeout ⇒ String, ...
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ Config
constructor
Creates a new configuration instance.
-
#url=(url) ⇒ void
Sets configuration from a URL string.
Constructor Details
Instance Attribute Details
#connection_timeout ⇒ String, ...
46 47 48 |
# File 'lib/ch_connect/config.rb', line 46 def connection_timeout @connection_timeout end |
#database ⇒ String, ...
46 47 48 |
# File 'lib/ch_connect/config.rb', line 46 def database @database end |
#host ⇒ String, ...
46 47 48 |
# File 'lib/ch_connect/config.rb', line 46 def host @host end |
#instrumenter ⇒ String, ...
46 47 48 |
# File 'lib/ch_connect/config.rb', line 46 def instrumenter @instrumenter end |
#keep_alive_timeout ⇒ String, ...
46 47 48 |
# File 'lib/ch_connect/config.rb', line 46 def keep_alive_timeout @keep_alive_timeout end |
#max_retries ⇒ String, ...
46 47 48 |
# File 'lib/ch_connect/config.rb', line 46 def max_retries @max_retries end |
#password ⇒ String, ...
46 47 48 |
# File 'lib/ch_connect/config.rb', line 46 def password @password end |
#pool_size ⇒ String, ...
46 47 48 |
# File 'lib/ch_connect/config.rb', line 46 def pool_size @pool_size end |
#pool_timeout ⇒ String, ...
46 47 48 |
# File 'lib/ch_connect/config.rb', line 46 def pool_timeout @pool_timeout end |
#port ⇒ String, ...
46 47 48 |
# File 'lib/ch_connect/config.rb', line 46 def port @port end |
#read_timeout ⇒ String, ...
46 47 48 |
# File 'lib/ch_connect/config.rb', line 46 def read_timeout @read_timeout end |
#scheme ⇒ String, ...
46 47 48 |
# File 'lib/ch_connect/config.rb', line 46 def scheme @scheme end |
#username ⇒ String, ...
46 47 48 |
# File 'lib/ch_connect/config.rb', line 46 def username @username end |
#write_timeout ⇒ String, ...
46 47 48 |
# File 'lib/ch_connect/config.rb', line 46 def write_timeout @write_timeout end |
Instance Method Details
#url=(url) ⇒ void
This method returns an undefined value.
Sets configuration from a URL string.
74 75 76 77 78 79 80 81 82 |
# File 'lib/ch_connect/config.rb', line 74 def url=(url) uri = URI(url) @scheme = uri.scheme @host = uri.host @port = uri.port @database = uri.path.delete_prefix("/") @username = uri.user @password = uri.password end |