Class: ClickHouse::Config
- Inherits:
-
Object
- Object
- ClickHouse::Config
- Defined in:
- lib/click_house/config.rb
Constant Summary collapse
- DEFAULTS =
{ adapter: Faraday.default_adapter, url: nil, scheme: 'http', host: 'localhost', port: '8123', logger: nil, database: nil, username: nil, password: nil, timeout: nil, open_timeout: nil, ssl_verify: false, headers: {}, global_params: {}, json_parser: ClickHouse::Middleware::ParseJson, json_serializer: ClickHouse::Serializer::JsonSerializer, oj_dump_options: { mode: :compat # to be able to dump improper JSON like {1 => 2} }, oj_load_options: { mode: :custom, allow_blank: true, bigdecimal_as_decimal: false, # dump BigDecimal as a String bigdecimal_load: :bigdecimal, # convert all decimal numbers to BigDecimal }, json_load_options: { decimal_class: BigDecimal, }, # should be after json load options symbolize_keys: false, }.freeze
Instance Attribute Summary collapse
-
#adapter ⇒ Object
Returns the value of attribute adapter.
-
#database ⇒ Object
Returns the value of attribute database.
-
#global_params ⇒ Object
Returns the value of attribute global_params.
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#host ⇒ Object
Returns the value of attribute host.
-
#json_load_options ⇒ Object
Returns the value of attribute json_load_options.
-
#json_parser ⇒ Object
response middleware.
-
#json_serializer ⇒ Object
[ClickHouse::Serializer::Base].
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#oj_dump_options ⇒ Object
Returns the value of attribute oj_dump_options.
-
#oj_load_options ⇒ Object
Returns the value of attribute oj_load_options.
-
#open_timeout ⇒ Object
Returns the value of attribute open_timeout.
-
#password ⇒ Object
Returns the value of attribute password.
-
#port ⇒ Object
Returns the value of attribute port.
-
#scheme ⇒ Object
Returns the value of attribute scheme.
-
#ssl_verify ⇒ Object
Returns the value of attribute ssl_verify.
-
#symbolize_keys ⇒ Object
[NilClass, Boolean].
-
#timeout ⇒ Object
Returns the value of attribute timeout.
-
#url ⇒ Object
Returns the value of attribute url.
-
#username ⇒ Object
Returns the value of attribute username.
Instance Method Summary collapse
- #assign(params = {}) ⇒ self
- #auth? ⇒ Boolean
-
#initialize(params = {}) {|_self| ... } ⇒ Config
constructor
A new instance of Config.
- #key(name) ⇒ Object
- #logger! ⇒ Object
- #null_logger ⇒ Object
- #url! ⇒ Object
Constructor Details
Instance Attribute Details
#adapter ⇒ Object
Returns the value of attribute adapter.
38 39 40 |
# File 'lib/click_house/config.rb', line 38 def adapter @adapter end |
#database ⇒ Object
Returns the value of attribute database.
43 44 45 |
# File 'lib/click_house/config.rb', line 43 def database @database end |
#global_params ⇒ Object
Returns the value of attribute global_params.
51 52 53 |
# File 'lib/click_house/config.rb', line 51 def global_params @global_params end |
#headers ⇒ Object
Returns the value of attribute headers.
50 51 52 |
# File 'lib/click_house/config.rb', line 50 def headers @headers end |
#host ⇒ Object
Returns the value of attribute host.
41 42 43 |
# File 'lib/click_house/config.rb', line 41 def host @host end |
#json_load_options ⇒ Object
Returns the value of attribute json_load_options.
53 54 55 |
# File 'lib/click_house/config.rb', line 53 def @json_load_options end |
#json_parser ⇒ Object
response middleware
54 55 56 |
# File 'lib/click_house/config.rb', line 54 def json_parser @json_parser end |
#json_serializer ⇒ Object
- ClickHouse::Serializer::Base
56 57 58 |
# File 'lib/click_house/config.rb', line 56 def json_serializer @json_serializer end |
#logger ⇒ Object
Returns the value of attribute logger.
39 40 41 |
# File 'lib/click_house/config.rb', line 39 def logger @logger end |
#oj_dump_options ⇒ Object
Returns the value of attribute oj_dump_options.
55 56 57 |
# File 'lib/click_house/config.rb', line 55 def @oj_dump_options end |
#oj_load_options ⇒ Object
Returns the value of attribute oj_load_options.
52 53 54 |
# File 'lib/click_house/config.rb', line 52 def @oj_load_options end |
#open_timeout ⇒ Object
Returns the value of attribute open_timeout.
48 49 50 |
# File 'lib/click_house/config.rb', line 48 def open_timeout @open_timeout end |
#password ⇒ Object
Returns the value of attribute password.
46 47 48 |
# File 'lib/click_house/config.rb', line 46 def password @password end |
#port ⇒ Object
Returns the value of attribute port.
42 43 44 |
# File 'lib/click_house/config.rb', line 42 def port @port end |
#scheme ⇒ Object
Returns the value of attribute scheme.
40 41 42 |
# File 'lib/click_house/config.rb', line 40 def scheme @scheme end |
#ssl_verify ⇒ Object
Returns the value of attribute ssl_verify.
49 50 51 |
# File 'lib/click_house/config.rb', line 49 def ssl_verify @ssl_verify end |
#symbolize_keys ⇒ Object
- NilClass, Boolean
57 58 59 |
# File 'lib/click_house/config.rb', line 57 def symbolize_keys @symbolize_keys end |
#timeout ⇒ Object
Returns the value of attribute timeout.
47 48 49 |
# File 'lib/click_house/config.rb', line 47 def timeout @timeout end |
#url ⇒ Object
Returns the value of attribute url.
44 45 46 |
# File 'lib/click_house/config.rb', line 44 def url @url end |
#username ⇒ Object
Returns the value of attribute username.
45 46 47 |
# File 'lib/click_house/config.rb', line 45 def username @username end |
Instance Method Details
#assign(params = {}) ⇒ self
65 66 67 68 69 |
# File 'lib/click_house/config.rb', line 65 def assign(params = {}) params.each { |k, v| public_send("#{k}=", v) } self end |
#auth? ⇒ Boolean
71 72 73 |
# File 'lib/click_house/config.rb', line 71 def auth? !username.nil? || !password.nil? end |
#key(name) ⇒ Object
103 104 105 |
# File 'lib/click_house/config.rb', line 103 def key(name) symbolize_keys ? name.to_sym : name.to_s end |
#logger! ⇒ Object
75 76 77 |
# File 'lib/click_house/config.rb', line 75 def logger! @logger || null_logger end |
#null_logger ⇒ Object
83 84 85 |
# File 'lib/click_house/config.rb', line 83 def null_logger @null_logger ||= Logger.new(IO::NULL) end |
#url! ⇒ Object
79 80 81 |
# File 'lib/click_house/config.rb', line 79 def url! @url || "#{scheme}://#{host}:#{port}" end |