function completeProxySetup()

in src/lib/awsConnectionParameters.ts [59:84]


function completeProxySetup(connectionParamaters: AWSConnectionParameters): void {
    if (!connectionParamaters.proxyConfiguration) {
        return
    }

    let proxy: Url
    try {
        if (typeof connectionParamaters.proxyConfiguration === 'string') {
            proxy = parse(connectionParamaters.proxyConfiguration)
        } else {
            const config = connectionParamaters.proxyConfiguration
            proxy = parse(config.proxyUrl)
            if (config.proxyUsername || config.proxyPassword) {
                proxy.auth = `${config.proxyUsername}:${config.proxyPassword}`
            }
        }

        // do not want any auth in the logged url
        tl.debug(`Configuring task for proxy host ${proxy.host}, protocol ${proxy.protocol}`)
        AWS.config.update({
            httpOptions: { agent: new HttpsProxyAgent(format(proxy)) }
        })
    } catch (err) {
        console.error(`Failed to process proxy configuration, error ${err}`)
    }
}