Class: Temporalio::EnvConfig::ClientConfig
- Inherits:
-
Object
- Object
- Temporalio::EnvConfig::ClientConfig
- Defined in:
- lib/temporalio/env_config.rb
Overview
Container for multiple client configuration profiles.
This class holds a collection of named client profiles loaded from configuration sources and provides methods for profile management and client connection configuration.
Class Method Summary collapse
-
.from_h(hash) ⇒ ClientConfig
Create a ClientConfig from a hash.
-
.load(config_source: nil, disable_file: false, config_file_strict: false, override_env_vars: nil) ⇒ ClientConfig
Load all client profiles from given sources.
-
.load_client_connect_options(profile: nil, config_source: nil, disable_file: false, disable_env: false, config_file_strict: false, override_env_vars: nil) ⇒ Array
Load a single client profile and convert to connect config.
Instance Method Summary collapse
-
#initialize(profiles: {}) ⇒ ClientConfig
constructor
Create a ClientConfig instance with defaults.
-
#to_h ⇒ Hash
Convert to a hash that can be used for TOML serialization.
Constructor Details
#initialize(profiles: {}) ⇒ ClientConfig
Create a ClientConfig instance with defaults
312 313 314 |
# File 'lib/temporalio/env_config.rb', line 312 def initialize(profiles: {}) super end |
Class Method Details
.from_h(hash) ⇒ ClientConfig
Create a ClientConfig from a hash
243 244 245 246 247 248 |
# File 'lib/temporalio/env_config.rb', line 243 def self.from_h(hash) profiles = hash.transform_values do |profile_hash| ClientConfigProfile.from_h(profile_hash) end new(profiles: profiles) end |
.load(config_source: nil, disable_file: false, config_file_strict: false, override_env_vars: nil) ⇒ ClientConfig
Load all client profiles from given sources.
This does not apply environment variable overrides to the profiles, it only uses an environment variable to find the default config file path (TEMPORAL_CONFIG_FILE).
261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 |
# File 'lib/temporalio/env_config.rb', line 261 def self.load( config_source: nil, disable_file: false, config_file_strict: false, override_env_vars: nil ) path, data = EnvConfig._source_to_path_and_data(config_source) loaded_profiles = Internal::Bridge::EnvConfig.load_client_config( path, data, disable_file, config_file_strict, override_env_vars || {} ) from_h(loaded_profiles) end |
.load_client_connect_options(profile: nil, config_source: nil, disable_file: false, disable_env: false, config_file_strict: false, override_env_vars: nil) ⇒ Array
Load a single client profile and convert to connect config
This is a convenience function that combines loading a profile and converting it to a connect config hash.
292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 |
# File 'lib/temporalio/env_config.rb', line 292 def self.( profile: nil, config_source: nil, disable_file: false, disable_env: false, config_file_strict: false, override_env_vars: nil ) prof = ClientConfigProfile.load( profile: profile, config_source: config_source, disable_file: disable_file, disable_env: disable_env, config_file_strict: config_file_strict, override_env_vars: override_env_vars ) prof. end |
Instance Method Details
#to_h ⇒ Hash
Convert to a hash that can be used for TOML serialization
318 319 320 |
# File 'lib/temporalio/env_config.rb', line 318 def to_h profiles.transform_values(&:to_h) end |