Class: Chroma::ChromaConfiguration
- Inherits:
-
Object
- Object
- Chroma::ChromaConfiguration
- Defined in:
- lib/chroma/chroma_configuration.rb
Overview
The ChromaConfiguration class allows you to configure the connection settings for a Chroma service client. It can be initialized directly calling #new method.
Examples
configuration = Chroma::ChromaConfiguration.new
configurarion.connect_host = "https://chroma.example.com"
Or via a setup block.
Examples
Chroma::ChromaConfiguration.setup do |config|
config.connect_host = "https://chroma.example.com"
end
Instance Attribute Summary collapse
-
#api_base ⇒ Object
Sets the base path for the Chroma API.
-
#api_key ⇒ Object
Sets the API Key for the Chroma service, for ‘x-chroma-token` header.
-
#api_version ⇒ Object
Sets the version of the Chroma API.
-
#connect_host ⇒ Object
Sets the host name for the Chroma service.
-
#database ⇒ Object
Sets the database for the Chroma service, Defaults to ‘default_database’.
-
#log_level ⇒ Object
Sets the logger’s log level for the Chroma service client.
-
#logger ⇒ Object
Sets the logger for the Chroma service client.
-
#tenant ⇒ Object
Sets the tenant for the Chroma service, Defaults to ‘default_tenant’.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ ChromaConfiguration
constructor
A new instance of ChromaConfiguration.
Constructor Details
#initialize ⇒ ChromaConfiguration
Returns a new instance of ChromaConfiguration.
95 96 97 98 99 100 101 102 103 |
# File 'lib/chroma/chroma_configuration.rb', line 95 def initialize @api_base = "api" @api_version = "v1" @log_level = Chroma::LEVEL_INFO @tenant ||= "default_tenant" @database ||= "default_database" end |
Instance Attribute Details
#api_base ⇒ Object
Sets the base path for the Chroma API.
Examples
config.api_base = "/api"
Returns the String API base path.
63 64 65 |
# File 'lib/chroma/chroma_configuration.rb', line 63 def api_base @api_base end |
#api_key ⇒ Object
Sets the API Key for the Chroma service, for ‘x-chroma-token` header.
Examples
config.api_key = "1234abcd"
Returns the String database.
54 55 56 |
# File 'lib/chroma/chroma_configuration.rb', line 54 def api_key @api_key end |
#api_version ⇒ Object
Sets the version of the Chroma API.
Examples
config.api_version = "v1"
Returns the String API version.
71 72 73 |
# File 'lib/chroma/chroma_configuration.rb', line 71 def api_version @api_version end |
#connect_host ⇒ Object
Sets the host name for the Chroma service.
Examples
config.connect_host = "chroma.example.com"
Returns the String host name.
27 28 29 |
# File 'lib/chroma/chroma_configuration.rb', line 27 def connect_host @connect_host end |
#database ⇒ Object
Sets the database for the Chroma service, Defaults to ‘default_database’.
Examples
config.database = "my_database"
Returns the String database.
45 46 47 |
# File 'lib/chroma/chroma_configuration.rb', line 45 def database @database end |
#log_level ⇒ Object
Sets the logger’s log level for the Chroma service client.
Examples
config.log_level = Chroma::LEVEL_INFO
Returns the log level constant
87 88 89 |
# File 'lib/chroma/chroma_configuration.rb', line 87 def log_level @log_level end |
#logger ⇒ Object
Sets the logger for the Chroma service client.
Examples
config.logger = Logger.new(STDOUT)
Returns the Logger instance.
79 80 81 |
# File 'lib/chroma/chroma_configuration.rb', line 79 def logger @logger end |
#tenant ⇒ Object
Sets the tenant for the Chroma service, Defaults to ‘default_tenant’.
Examples
config.tenant = "my_tenant"
Returns the String tenant.
36 37 38 |
# File 'lib/chroma/chroma_configuration.rb', line 36 def tenant @tenant end |
Class Method Details
.setup ⇒ Object
89 90 91 92 93 |
# File 'lib/chroma/chroma_configuration.rb', line 89 def self.setup new.tap do |instance| yield(instance) if block_given? end end |