@sap-cloud-sdk/connectivity
Version:
SAP Cloud SDK for JavaScript connectivity
36 lines (35 loc) • 2.22 kB
TypeScript
import type { Destination, HttpDestination } from './destination-service-types';
import type { BasicProxyConfiguration, ProxyConfiguration } from '../connectivity-service-types';
type ProxyStrategy = 'no-proxy' | 'on-premise' | 'internet' | 'private-link';
/**
* @internal
* Determines the proxy strategy. If the 'no_proxy' env variable is set, the `ProxyConfiguration` in the destination is omitted.
* For the 'on-premise' and 'internet' proxy strategies the connectivity service or environment variables are checked to fill the `ProxyConfiguration`.
* @param destination - Destination to derive the proxy strategy from.
* @returns The proxy strategy for the given destination.
*/
export declare function proxyStrategy(destination: Destination): ProxyStrategy;
/**
* Parses the environment variable for the web proxy and extracts the values considering defaults like http for the protocol and 80 or 443 for the port.
* The general pattern to be parsed is `protocol://user:password@host:port`, where everything besides the host is optional.
* Special characters in the user and password need to be percent encoded.
* @param proxyEnvValue - Environment variable which is parsed.
* @returns Configuration with default values or `undefined` if the parsing failed.
*/
export declare function parseProxyEnv(proxyEnvValue: string): ProxyConfiguration | undefined;
/**
* Adds the proxy configuration to a destination based on web proxies defined in environment variables. See {@link ProxyConfiguration} and {@link proxyStrategy} for details.
* @param destination - to which the proxy configuration is added.
* @returns Destination containing the configuration for web proxy.
* @internal
*/
export declare function addProxyConfigurationInternet(destination: HttpDestination): HttpDestination;
/**
* Picks the the proxy config properties.
* Note, that the protocol ('http' or 'https') is not related to the destinations' target system protocol and in most cases 'http'.
* @param destination - Destination containing the proxy configuration.
* @returns Reduced proxy configuration.
* @internal
*/
export declare function getProxyConfig(destination: HttpDestination): BasicProxyConfiguration | false;
export {};