From 1cae26559cfd085db7397b7026ea005c9aac6d44 Mon Sep 17 00:00:00 2001 From: Greg Peranich Date: Fri, 29 Nov 2024 04:39:04 -0500 Subject: [PATCH] added flag to set ip_version in redis client (#60) * added flag to set ip_version in redis client Signed-off-by: Greg Peranich * fixed APP_COLOR and updated README Signed-off-by: Greg Peranich --------- Signed-off-by: Greg Peranich --- README.md | 3 ++- app/public/index.html | 3 +-- app/server.js | 5 +++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 9cb6b95..f4eb79f 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,8 @@ We can configure the following environment variables when running `demo-app`: * `REDIS_HOST`: Determines the hostname to use when connecting to Redis. Default is `127.0.0.1`. * `REDIS_PORT`: Determines the port to use when connecting to Redis. Default is `6379`. * `APP_VERSION`: Lets you change the version number displayed in the main page of `demo-app`. Default is `1.0`. -* `APP_COLOR`: Lets you change background color of the `demo-app` main page. Default is `#efefef`. +* `APP_COLOR`: Lets you change background color of the `demo-app` main page. Default is `#FAFAFA`. +* `IP_VERSION`: Lets you change the IP family version to use when connecting to Redis. Default is `4` for IPv4, with the option to set as `6` for IPv6. The `APP_VERSION` and `APP_COLOR` environment variables are handy when we want to create different versions of `demo-app` and get immediate visual feedback when routing across them. diff --git a/app/public/index.html b/app/public/index.html index e717a3a..8f59b2c 100644 --- a/app/public/index.html +++ b/app/public/index.html @@ -174,7 +174,6 @@ #header { padding: 50px; - background-color: #efefef; } #counter { @@ -443,7 +442,7 @@
-

Kuma Counter Demo

+

Kuma Counter Demo

Welcome to a simple demo application to demonstrate how the Kuma service mesh works. This application allows us to increment a counter, and it is made of two different services: diff --git a/app/server.js b/app/server.js index 1648264..0352611 100644 --- a/app/server.js +++ b/app/server.js @@ -10,16 +10,17 @@ const PORT = 5000; const app = express(); const version = process.env.APP_VERSION || "1.0"; -const color = process.env.APP_COLOR || "#efefef"; +const color = process.env.APP_COLOR || "#FAFAFA"; function getClient() { const host = process.env.REDIS_HOST || "127.0.0.1"; const port = parseInt(process.env.REDIS_PORT) || 6379; + const ip_version = parseInt(process.env.IP_VERSION) || 4; console.log("Connecting to Redis at %s:%d", host, port); const client = new Redis({ port: port, host: host, - family: 4, + family: ip_version, autoResendUnfulfilledCommands: false, autoResubscribe: false, enableOfflineQueue: true,