Class: Temporalio::EnvConfig::ClientConfigTLS

Inherits:
Data
  • Object
show all
Defined in:
lib/temporalio/env_config.rb,
lib/temporalio/env_config.rb

Overview

TLS configuration for Temporal client connections.

This class provides methods for creating, serializing, and converting TLS configuration objects used by Temporal clients.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(disabled: nil, server_name: nil, server_root_ca_cert: nil, client_cert: nil, client_private_key: nil) ⇒ ClientConfigTLS

Set default values



47
48
49
50
# File 'lib/temporalio/env_config.rb', line 47

def initialize(disabled: nil, server_name: nil, server_root_ca_cert: nil, client_cert: nil,
               client_private_key: nil)
  super
end

Instance Attribute Details

#client_certObject (readonly)

Returns the value of attribute client_cert

Returns:

  • (Object)

    the current value of client_cert



24
# File 'lib/temporalio/env_config.rb', line 24

ClientConfigTLS = Data.define(:disabled, :server_name, :server_root_ca_cert, :client_cert, :client_private_key)

#client_private_keyObject (readonly)

Returns the value of attribute client_private_key

Returns:

  • (Object)

    the current value of client_private_key



24
# File 'lib/temporalio/env_config.rb', line 24

ClientConfigTLS = Data.define(:disabled, :server_name, :server_root_ca_cert, :client_cert, :client_private_key)

#disabledObject (readonly)

Returns the value of attribute disabled

Returns:

  • (Object)

    the current value of disabled



24
# File 'lib/temporalio/env_config.rb', line 24

ClientConfigTLS = Data.define(:disabled, :server_name, :server_root_ca_cert, :client_cert, :client_private_key)

#server_nameObject (readonly)

Returns the value of attribute server_name

Returns:

  • (Object)

    the current value of server_name



24
# File 'lib/temporalio/env_config.rb', line 24

ClientConfigTLS = Data.define(:disabled, :server_name, :server_root_ca_cert, :client_cert, :client_private_key)

#server_root_ca_certObject (readonly)

Returns the value of attribute server_root_ca_cert

Returns:

  • (Object)

    the current value of server_root_ca_cert



24
# File 'lib/temporalio/env_config.rb', line 24

ClientConfigTLS = Data.define(:disabled, :server_name, :server_root_ca_cert, :client_cert, :client_private_key)

Class Method Details

.from_h(hash) ⇒ ClientConfigTLS?

Create a ClientConfigTLS from a hash

Parameters:

  • hash (Hash, nil)

    Hash representation

Returns:

  • (ClientConfigTLS, nil)

    The TLS configuration or nil if hash is nil/empty



34
35
36
37
38
39
40
41
42
43
44
# File 'lib/temporalio/env_config.rb', line 34

def self.from_h(hash)
  return nil if hash.nil? || hash.empty?

  new(
    disabled: hash[:disabled],
    server_name: hash[:server_name],
    server_root_ca_cert: hash_to_source(hash[:server_ca_cert]),
    client_cert: hash_to_source(hash[:client_cert]),
    client_private_key: hash_to_source(hash[:client_key])
  )
end

Instance Method Details

#to_client_tls_optionsConnection::TLSOptions, false

Create a TLS configuration for use with connections

Returns:

  • (Connection::TLSOptions, false)

    TLS options or false if disabled



66
67
68
69
70
71
72
73
74
75
# File 'lib/temporalio/env_config.rb', line 66

def to_client_tls_options
  return false if disabled

  Client::Connection::TLSOptions.new(
    domain: server_name,
    server_root_ca_cert: read_source(server_root_ca_cert),
    client_cert: read_source(client_cert),
    client_private_key: read_source(client_private_key)
  )
end

#to_hHash

Convert to a hash that can be used for TOML serialization

Returns:

  • (Hash)

    Dictionary representation



54
55
56
57
58
59
60
61
62
# File 'lib/temporalio/env_config.rb', line 54

def to_h
  {
    disabled:,
    server_name:,
    server_ca_cert: server_root_ca_cert ? source_to_hash(server_root_ca_cert) : nil,
    client_cert: client_cert ? source_to_hash(client_cert) : nil,
    client_key: client_private_key ? source_to_hash(client_private_key) : nil
  }.compact
end