Skip to content

Commit

Permalink
added flag to set ip_version in redis client (#60)
Browse files Browse the repository at this point in the history
* added flag to set ip_version in redis client

Signed-off-by: Greg Peranich <[email protected]>

* fixed APP_COLOR and updated README

Signed-off-by: Greg Peranich <[email protected]>

---------

Signed-off-by: Greg Peranich <[email protected]>
  • Loading branch information
gperanich authored Nov 29, 2024
1 parent 68e39bc commit 1cae265
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
3 changes: 1 addition & 2 deletions app/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@

#header {
padding: 50px;
background-color: #efefef;
}

#counter {
Expand Down Expand Up @@ -443,7 +442,7 @@

<div class="columns">
<div class="info">
<h1 class="type-xxxl">Kuma Counter Demo <span id="version"></span></h1>
<h1 class="type-xxxl" id="header">Kuma Counter Demo <span id="version"></span></h1>
<p class="type-xl">
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:
Expand Down
5 changes: 3 additions & 2 deletions app/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 1cae265

Please sign in to comment.