Class: Zitadel::Client::Configuration
- Inherits:
-
Object
- Object
- Zitadel::Client::Configuration
- 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
-
#authenticator ⇒ Authenticator
readonly
The authentication strategy used to authorize requests.
-
#cert_file ⇒ String
Path to the client certificate file for mutual TLS (mTLS).
-
#client_side_validation ⇒ Boolean
Enables or disables client-side request validation.
-
#debugging ⇒ Boolean
Enables or disables debug logging.
-
#key_file ⇒ String
Path to the private key file for the client certificate.
-
#logger ⇒ #debug
The logger used to output debugging information.
-
#params_encoding ⇒ Symbol?
Custom encoding strategy for query parameters that are arrays.
-
#ssl_ca_cert ⇒ String
Path to the certificate file used to verify the peer.
-
#temp_folder_path ⇒ String
Directory path used to temporarily store files returned by API responses (e.g., when downloading files).
-
#timeout ⇒ Integer
Request timeout duration in seconds.
-
#user_agent ⇒ String?
The User-Agent header to be sent with HTTP requests.
-
#verify_ssl ⇒ Boolean
Controls whether SSL certificates are verified when making HTTPS requests.
-
#verify_ssl_host ⇒ Boolean
Controls whether SSL hostnames are verified during HTTPS communication.
Instance Method Summary collapse
-
#configure {|self| ... } ⇒ Object
Allows modifying the current instance using a configuration block.
-
#initialize(authenticator = Auth::NoAuthAuthenticator.new) {|_self| ... } ⇒ Configuration
constructor
rubocop:disable Metrics/MethodLength.
Constructor Details
#initialize(authenticator = Auth::NoAuthAuthenticator.new) {|_self| ... } ⇒ Configuration
rubocop:disable Metrics/MethodLength
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
#authenticator ⇒ Authenticator (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.
42 43 44 |
# File 'lib/zitadel/client/configuration.rb', line 42 def authenticator @authenticator end |
#cert_file ⇒ String
Path to the client certificate file for mutual TLS (mTLS).
This is optional and only required when server expects client-side certificates.
123 124 125 |
# File 'lib/zitadel/client/configuration.rb', line 123 def cert_file @cert_file end |
#client_side_validation ⇒ Boolean
Enables or disables client-side request validation.
When disabled, validation of input parameters is skipped. Defaults to ‘true`.
84 85 86 |
# File 'lib/zitadel/client/configuration.rb', line 84 def client_side_validation @client_side_validation end |
#debugging ⇒ Boolean
Enables or disables debug logging.
When enabled, HTTP request and response details are logged via the configured ‘logger` instance.
51 52 53 |
# File 'lib/zitadel/client/configuration.rb', line 51 def debugging @debugging end |
#key_file ⇒ String
Path to the private key file for the client certificate.
Used with ‘cert_file` during mutual TLS authentication.
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.
60 61 62 |
# File 'lib/zitadel/client/configuration.rb', line 60 def logger @logger end |
#params_encoding ⇒ Symbol?
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_cert ⇒ String
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_path ⇒ String
Directory path used to temporarily store files returned by API responses (e.g., when downloading files).
67 68 69 |
# File 'lib/zitadel/client/configuration.rb', line 67 def temp_folder_path @temp_folder_path end |
#timeout ⇒ Integer
Request timeout duration in seconds.
If set to ‘0`, requests will never time out.
75 76 77 |
# File 'lib/zitadel/client/configuration.rb', line 75 def timeout @timeout end |
#user_agent ⇒ String?
The User-Agent header to be sent with HTTP requests.
Set this to identify your client or library when making requests.
150 151 152 |
# File 'lib/zitadel/client/configuration.rb', line 150 def user_agent @user_agent end |
#verify_ssl ⇒ Boolean
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.
94 95 96 |
# File 'lib/zitadel/client/configuration.rb', line 94 def verify_ssl @verify_ssl end |
#verify_ssl_host ⇒ Boolean
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.
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.
175 176 177 |
# File 'lib/zitadel/client/configuration.rb', line 175 def configure yield(self) if block_given? end |