Class: Zitadel::Client::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/zitadel/client/configuration.rb

Overview

Configuration class for the Zitadel::Client SDK.

This class defines all client-level options including timeouts, logging, SSL behavior, and validation controls. It allows you to customize how API calls are made and handled internally.

Example:

config = Zitadel::Client::Configuration.new do |c|
  c.debugging = true
  c.timeout = 10
  c.verify_ssl = true
end

noinspection RubyTooManyInstanceVariablesInspection

Constant Summary collapse

USER_AGENT =
[
  "zitadel-client/#{VERSION}",

  [
    'lang=ruby',
    "lang_version=#{RUBY_VERSION}",
    "os=#{RUBY_PLATFORM}",
    "arch=#{RbConfig::CONFIG['host_cpu']}"
  ].join('; ')
    .prepend('(').concat(')')
].join(' ')

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(authenticator = Auth::NoAuthAuthenticator.new) {|_self| ... } ⇒ Configuration

rubocop:disable Metrics/MethodLength

Yields:

  • (_self)

Yield Parameters:



153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
# File 'lib/zitadel/client/configuration.rb', line 153

def initialize(authenticator = Auth::NoAuthAuthenticator.new)
  @authenticator = authenticator
  @client_side_validation = true
  @verify_ssl = true
  @verify_ssl_host = true
  @cert_file = nil
  @key_file = nil
  @timeout = 0
  @params_encoding = nil
  @debugging = false
  @logger = nil
  @user_agent = USER_AGENT

  yield(self) if block_given?
end

Instance Attribute Details

#authenticatorAuthenticator (readonly)

The authentication strategy used to authorize requests.

This is typically an instance of a class implementing an interface like ‘#authenticate(request)`, such as `NoAuthAuthenticator` or a custom implementation.

Returns:

  • (Authenticator)

    the authenticator instance



42
43
44
# File 'lib/zitadel/client/configuration.rb', line 42

def authenticator
  @authenticator
end

#cert_fileString

Path to the client certificate file for mutual TLS (mTLS).

This is optional and only required when server expects client-side certificates.

Returns:

  • (String)


123
124
125
# File 'lib/zitadel/client/configuration.rb', line 123

def cert_file
  @cert_file
end

#client_side_validationBoolean

Enables or disables client-side request validation.

When disabled, validation of input parameters is skipped. Defaults to ‘true`.

Returns:

  • (Boolean)


84
85
86
# File 'lib/zitadel/client/configuration.rb', line 84

def client_side_validation
  @client_side_validation
end

#debuggingBoolean

Enables or disables debug logging.

When enabled, HTTP request and response details are logged via the configured ‘logger` instance.

Returns:

  • (Boolean)


51
52
53
# File 'lib/zitadel/client/configuration.rb', line 51

def debugging
  @debugging
end

#key_fileString

Path to the private key file for the client certificate.

Used with ‘cert_file` during mutual TLS authentication.

Returns:

  • (String)


131
132
133
# File 'lib/zitadel/client/configuration.rb', line 131

def key_file
  @key_file
end

#logger#debug

The logger used to output debugging information.

Defaults to ‘Rails.logger` if Rails is defined; otherwise, logs to STDOUT.

Returns:

  • (#debug)


60
61
62
# File 'lib/zitadel/client/configuration.rb', line 60

def logger
  @logger
end

#params_encodingSymbol?

Custom encoding strategy for query parameters that are arrays.

Set this if your server expects a specific collection format (e.g., ‘multi`, `csv`, etc.). Defaults to `nil`.



142
143
144
# File 'lib/zitadel/client/configuration.rb', line 142

def params_encoding
  @params_encoding
end

#ssl_ca_certString

Path to the certificate file used to verify the peer.

This is used in place of system-level certificate stores.



114
115
116
# File 'lib/zitadel/client/configuration.rb', line 114

def ssl_ca_cert
  @ssl_ca_cert
end

#temp_folder_pathString

Directory path used to temporarily store files returned by API responses (e.g., when downloading files).

Returns:

  • (String)


67
68
69
# File 'lib/zitadel/client/configuration.rb', line 67

def temp_folder_path
  @temp_folder_path
end

#timeoutInteger

Request timeout duration in seconds.

If set to ‘0`, requests will never time out.

Returns:

  • (Integer)


75
76
77
# File 'lib/zitadel/client/configuration.rb', line 75

def timeout
  @timeout
end

#user_agentString?

The User-Agent header to be sent with HTTP requests.

Set this to identify your client or library when making requests.

Returns:

  • (String, nil)


150
151
152
# File 'lib/zitadel/client/configuration.rb', line 150

def user_agent
  @user_agent
end

#verify_sslBoolean

Controls whether SSL certificates are verified when making HTTPS requests.

Set to ‘false` to bypass certificate verification. Defaults to `true`. Note: This should always be `true` in production.

Returns:

  • (Boolean)


94
95
96
# File 'lib/zitadel/client/configuration.rb', line 94

def verify_ssl
  @verify_ssl
end

#verify_ssl_hostBoolean

Controls whether SSL hostnames are verified during HTTPS communication.

Set to ‘false` to skip hostname verification. Defaults to `true`. Note: Disabling this weakens transport security.

Returns:

  • (Boolean)


104
105
106
# File 'lib/zitadel/client/configuration.rb', line 104

def verify_ssl_host
  @verify_ssl_host
end

Instance Method Details

#configure {|self| ... } ⇒ Object

Allows modifying the current instance using a configuration block.

Yield Parameters:



175
176
177
# File 'lib/zitadel/client/configuration.rb', line 175

def configure
  yield(self) if block_given?
end