Daniel-t / node-red-contrib-aws

A collection of Node-RED nodes for AWS.
Apache License 2.0
57 stars 59 forks source link

How do I configure a Proxy for all Nodes #37

Closed colwilson-mo closed 6 years ago

colwilson-mo commented 6 years ago

I'm behind a proxy and I've had to use 'proxy-agent' near the top of S3.js like this to get it to work:

        var proxy = require('proxy-agent');
        AWS.config.update({
            httpOptions: { agent: proxy('http://webproxy:8080') }
        });

This does work, but I don;t want to have to modify every single node that I want to use.

Is there a way to do this once and globally?

Daniel-t commented 6 years ago

This makes sense, but is not possible at the moment. It will require a change to the config node (to take a JSON configuration string) and all the other nodes.

In the mean time if you're desperate, all the code is dynamically generated, in gen.js make your change around line 200, run the run_build.js, then copy the files back to the parent directory.

tcpipchip commented 6 years ago

To test your node-aws, must i copy the code to /root/.node-red directory ?

Daniel-t commented 6 years ago

it depends on how you install it, if you use 'npm install node-red-contrib-aws' it should install fine. If you cline the repository it will need to be in a node_modules folder under .node-red

Daniel-t commented 6 years ago

Documentation for proxy configuration https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/node-configuring-proxies.html

var proxy = require('proxy-agent');

AWS.config.update({
  httpOptions: { agent: proxy('http://internal.proxy.com') }
});