Help Center> Object Storage Service> Node.js> Initialization> Configuring an Instance of ObsClient
Updated on 2024-02-28 GMT+08:00

Configuring an Instance of ObsClient

If you have any questions during development, post them on the Issues page of GitHub. For details about parameters and usage of each API, see the API Reference.

You can set the following initialization parameters to configure an instance of ObsClient.

Parameter

Description

Recommended Value

access_key_id

AK

N/A

secret_access_key

SK

N/A

server

Endpoint for accessing OBS, which contains the protocol type, domain name (or IP address), and port number. For example, https://your-endpoint:443. For security purposes, you are advised to use HTTPS.

N/A

max_retry_count

Maximum number of retries when an HTTP/HTTPS connection is abnormal. The default value is 3.

[1, 5]

timeout

Timeout period (in seconds) of an HTTP/HTTPS request. The default value is 60.

[10, 60]

http_agent

(Optional) Whether to use the HTTP agent. By default, this parameter is not configured.

N/A

https_agent

(Optional) Whether to use the HTTPS agent. By default, this parameter is not configured.

N/A

ssl_verify

Whether to verify server-side certificates. Possible values are:

  • Path to the server-side root certificate file in .pem format
  • true: The default CAs are used to verify the server-side certificate.
  • false: The server-side certificates will not be verified.

The default value is false.

N/A

long_conn_param

Persistent connection mode (in seconds). If the value is equal to or larger than 0, the persistent connection mode is enabled and this value is used as the initial delay of the TCP Keep-Alive packets.

By default, this parameter is left blank, which indicates that persistent connection mode is disabled.

N/A

is_cname

Whether to use self-defined domain name to access OBS. The default value is false.

N/A

  • Parameters whose recommended value is N/A need to be set according to the actual conditions.
  • If the network is unstable, you are advised to set a larger value for timeout.
  • If the value of server does not contain any protocol, HTTPS is used by default.
  • If the persistent connection mode is enabled, you must call ObsClient.close to close ObsClient explicitly to reclaim connection resources.
  • For the sake of high DNS resolution performance and OBS reliability, you can set server only to the domain name of OBS, instead of the IP address.
  • For details about SDK proxy configuration, see Configuring Proxies for the SDK.