Class: Temporalio::EnvConfig::ClientConfigProfile
- Inherits:
-
Object
- Object
- Temporalio::EnvConfig::ClientConfigProfile
- Defined in:
- lib/temporalio/env_config.rb
Overview
A client configuration profile loaded from environment and files.
This class represents a complete client configuration profile that can be loaded from TOML files and environment variables, and converted to client connection options.
Class Method Summary collapse
-
.from_h(hash) ⇒ ClientConfigProfile
Create a ClientConfigProfile from a hash.
-
.load(profile: nil, config_source: nil, disable_file: false, disable_env: false, config_file_strict: false, override_env_vars: nil) ⇒ ClientConfigProfile
Load a single client profile from given sources, applying env overrides.
Instance Method Summary collapse
-
#initialize(address: nil, namespace: nil, api_key: nil, tls: nil, grpc_meta: {}) ⇒ ClientConfigProfile
constructor
Create a ClientConfigProfile instance with defaults.
-
#to_client_connect_options ⇒ Array
Create a client connect config from this profile.
-
#to_h ⇒ Hash
Convert to a hash that can be used for TOML serialization.
Constructor Details
#initialize(address: nil, namespace: nil, api_key: nil, tls: nil, grpc_meta: {}) ⇒ ClientConfigProfile
Create a ClientConfigProfile instance with defaults
196 197 198 |
# File 'lib/temporalio/env_config.rb', line 196 def initialize(address: nil, namespace: nil, api_key: nil, tls: nil, grpc_meta: {}) super end |
Class Method Details
.from_h(hash) ⇒ ClientConfigProfile
Create a ClientConfigProfile from a hash
152 153 154 155 156 157 158 159 160 |
# File 'lib/temporalio/env_config.rb', line 152 def self.from_h(hash) new( address: hash[:address], namespace: hash[:namespace], api_key: hash[:api_key], tls: ClientConfigTLS.from_h(hash[:tls]), grpc_meta: hash[:grpc_meta] || {} ) end |
.load(profile: nil, config_source: nil, disable_file: false, disable_env: false, config_file_strict: false, override_env_vars: nil) ⇒ ClientConfigProfile
Load a single client profile from given sources, applying env overrides.
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 |
# File 'lib/temporalio/env_config.rb', line 172 def self.load( profile: nil, config_source: nil, disable_file: false, disable_env: false, config_file_strict: false, override_env_vars: nil ) path, data = EnvConfig._source_to_path_and_data(config_source) raw_profile = Internal::Bridge::EnvConfig.load_client_connect_config( profile, path, data, disable_file, disable_env, config_file_strict, override_env_vars || {} ) from_h(raw_profile) end |
Instance Method Details
#to_client_connect_options ⇒ Array
Create a client connect config from this profile
214 215 216 217 218 219 220 221 222 223 |
# File 'lib/temporalio/env_config.rb', line 214 def positional_args = [address, namespace].compact keyword_args = { api_key: api_key, tls: tls&., rpc_metadata: ( if && !.empty?) }.compact [positional_args, keyword_args] end |
#to_h ⇒ Hash
Convert to a hash that can be used for TOML serialization
202 203 204 205 206 207 208 209 210 |
# File 'lib/temporalio/env_config.rb', line 202 def to_h { address: address, namespace: namespace, api_key: api_key, tls: tls&.to_h&.then { |tls_hash| tls_hash.empty? ? nil : tls_hash }, # steep:ignore grpc_meta: && .empty? ? nil : }.compact end |