* When the user sets the cloud options, it uses the secure bundle or endpoint to access the metadata service and * setting the connection options * @param {ClientOptions} options * @returns {Promise }
(options)
| 38 | * @returns {Promise<void>} |
| 39 | */ |
| 40 | async function init(options) { |
| 41 | if (!options.cloud) { |
| 42 | return; |
| 43 | } |
| 44 | |
| 45 | const cloudOptions = new CloudOptions(options); |
| 46 | await parseZipFile(cloudOptions); |
| 47 | await getMetadataServiceInfoAsync(cloudOptions); |
| 48 | |
| 49 | if (!cloudOptions.clientOptions.sslOptions.checkServerIdentity) { |
| 50 | // With SNI enabled, hostname (uuid) and CN will not match |
| 51 | // Use a custom validation function to validate against the proxy address. |
| 52 | // Note: this function is only called if the certificate passed all other checks, like CA validation. |
| 53 | cloudOptions.clientOptions.sslOptions.checkServerIdentity = (_, cert) => |
| 54 | checkServerIdentity(cert, cloudOptions.clientOptions.sni.address); |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | class CloudOptions { |
| 59 | constructor(clientOptions) { |
nothing calls this directly
no test coverage detected