Skip to content

Commit 5223977

Browse files
committed
Add crude http proxy support
1 parent a98ad18 commit 5223977

8 files changed

Lines changed: 29 additions & 3 deletions

File tree

OpenFlow/src/Config.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ export class Config {
4444
Config.getting_started_url = Config.getEnv("getting_started_url", "");
4545

4646
Config.NODE_ENV = Config.getEnv("NODE_ENV", "development");
47+
Config.HTTP_PROXY = Config.getEnv("HTTP_PROXY", "");
48+
Config.HTTPS_PROXY = Config.getEnv("HTTPS_PROXY", "");
49+
4750

4851
Config.stripe_api_key = Config.getEnv("stripe_api_key", "");
4952
Config.stripe_api_secret = Config.getEnv("stripe_api_secret", "");
@@ -201,6 +204,8 @@ export class Config {
201204
public static getting_started_url: string = Config.getEnv("getting_started_url", "");
202205

203206
public static NODE_ENV: string = Config.getEnv("NODE_ENV", "development");
207+
public static HTTP_PROXY: string = Config.getEnv("HTTP_PROXY", "");
208+
public static HTTPS_PROXY: string = Config.getEnv("HTTPS_PROXY", "");
204209

205210
public static stripe_api_key: string = Config.getEnv("stripe_api_key", "");
206211
public static stripe_api_secret: string = Config.getEnv("stripe_api_secret", "");

OpenFlow/src/Messages/Message.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1959,6 +1959,8 @@ export class Message {
19591959
"prometheus_measure_nodeid=" + Config.prometheus_measure_nodeid.toString(),
19601960
"prometheus_measure_queued_messages=" + Config.prometheus_measure_queued_messages.toString(),
19611961
"NODE_ENV=" + Config.NODE_ENV,
1962+
"HTTP_PROXY=" + Config.HTTP_PROXY,
1963+
"HTTPS_PROXY=" + Config.HTTPS_PROXY,
19621964
"prometheus_expose_metric=" + "false",
19631965
"enable_analytics=" + Config.enable_analytics.toString(),
19641966
"otel_trace_url=" + Config.otel_trace_url,
@@ -1967,6 +1969,7 @@ export class Message {
19671969
"otel_metric_interval=" + Config.otel_metric_interval.toString(),
19681970
"amqp_enabled_exchange=" + Config.amqp_enabled_exchange.toString()
19691971
]
1972+
19701973
// const image = await docker.pull(nodered_image, { serveraddress: "https://index.docker.io/v1" });
19711974
await this._pullImage(docker, nodered_image);
19721975
instance = await docker.createContainer({
@@ -2215,6 +2218,8 @@ export class Message {
22152218
{ name: "prometheus_measure_nodeid", value: Config.prometheus_measure_nodeid.toString() },
22162219
{ name: "prometheus_measure_queued_messages", value: Config.prometheus_measure_queued_messages.toString() },
22172220
{ name: "NODE_ENV", value: Config.NODE_ENV },
2221+
{ name: "HTTP_PROXY", value: Config.HTTP_PROXY },
2222+
{ name: "HTTPS_PROXY", value: Config.HTTPS_PROXY },
22182223
{ name: "prometheus_expose_metric", value: "false" },
22192224
{ name: "enable_analytics", value: Config.enable_analytics.toString() },
22202225
{ name: "otel_trace_url", value: Config.otel_trace_url },

OpenFlowNodeRED/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@openiap/nodered",
3-
"version": "1.3.88",
3+
"version": "1.3.89",
44
"description": "Simple wrapper around NodeRed, RabbitMQ and MongoDB to support a more scaleable NodeRed implementation.\r Also the \"backend\" for [OpenRPA](https://github.com/skadefro/OpenRPA)",
55
"main": "index.js",
66
"scripts": {

OpenFlowNodeRED/src/Config.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ export class Config {
2323
Config.nodered_sa = Config.getEnv("nodered_sa", "");
2424

2525
Config.NODE_ENV = Config.getEnv("NODE_ENV", "development");
26+
Config.HTTP_PROXY = Config.getEnv("HTTP_PROXY", "");
27+
Config.HTTPS_PROXY = Config.getEnv("HTTPS_PROXY", "");
2628

2729
Config.saml_federation_metadata = Config.getEnv("saml_federation_metadata", "");
2830
Config.saml_issuer = Config.getEnv("saml_issuer", "");
@@ -89,6 +91,8 @@ export class Config {
8991
public static nodered_sa: string = Config.getEnv("nodered_sa", "");
9092

9193
public static NODE_ENV: string = Config.getEnv("NODE_ENV", "development");
94+
public static HTTP_PROXY: string = Config.getEnv("HTTP_PROXY", "");
95+
public static HTTPS_PROXY: string = Config.getEnv("HTTPS_PROXY", "");
9296

9397
public static allow_start_from_cache: boolean = Config.parseBoolean(Config.getEnv("allow_start_from_cache", "false"));
9498
public static auto_restart_when_needed: boolean = Config.parseBoolean(Config.getEnv("auto_restart_when_needed", "true"));

OpenFlowNodeRED/src/node-red-contrib-openflow-storage.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,15 @@ export class noderedcontribopenflowstorage {
581581
// npmrc = new noderednpmrc();
582582
// npmrc.content = fs.readFileSync(npmrcFile, "utf8");
583583
// await this._setnpmrc(npmrc);
584+
} else if (!NoderedUtil.IsNullEmpty(Config.HTTP_PROXY) || !NoderedUtil.IsNullEmpty(Config.HTTPS_PROXY)) {
585+
const npmrc = new noderednpmrc();
586+
npmrc.content = "proxy=" + Config.HTTP_PROXY + "\n" + "https-proxy=" + Config.HTTPS_PROXY;
587+
npmrc.content += "\n" + "registry=http://registry.npmjs.org/";
588+
fs.writeFileSync(npmrcFile, npmrc.content);
589+
} else {
590+
if (fs.existsSync(npmrcFile)) {
591+
fs.unlinkSync(npmrcFile);
592+
}
584593
}
585594
//}
586595
} catch (error) {

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.3.88
1+
1.3.89

docker-compose-traefik.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ services:
6262
- protocol=http
6363
- port=3000
6464
- domain=localhost.openiap.io
65+
# Fill to set proxy settings inside docker instances, you may also need to add an npmrc entry to the nodered collection !
66+
- HTTP_PROXY=
67+
- HTTPS_PROXY=
6568

6669
- enable_openflow_amqp=false # enable this to use the openflow amqp, only usefull when you have more than one replicas
6770
- amqp_prefetch=25

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@openiap/openflow",
3-
"version": "1.3.88",
3+
"version": "1.3.89",
44
"description": "Simple wrapper around NodeRed, RabbitMQ and MongoDB to support a more scaleable NodeRed implementation.\r Also the \"backend\" for [OpenRPA](https://github.com/skadefro/OpenRPA)",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)