Skip to content

Commit 33e571e

Browse files
CLDSRV-717: Fix & drop config root redis for utapi
Currently, root redis is not defined neither by zenko or s3c. This breaks utapi replay with overrided redis config. There has been multiple tickets S3C-1399 ZENKO-345 ZENKO-1051 ZENKO-3294 In the end root redis is not used and utapi should use utapi.redis and cloudserver uses localCache.
1 parent 73488a3 commit 33e571e

7 files changed

Lines changed: 12 additions & 23 deletions

File tree

docker-entrypoint.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,15 +120,15 @@ if [[ "$REDIS_PORT" ]] && [[ ! "$REDIS_SENTINELS" ]]; then
120120
fi
121121

122122
if [[ "$REDIS_SENTINELS" ]]; then
123-
JQ_FILTERS_CONFIG="$JQ_FILTERS_CONFIG | .redis.name=\"$REDIS_HA_NAME\""
124-
JQ_FILTERS_CONFIG="$JQ_FILTERS_CONFIG | .redis.sentinels=\"$REDIS_SENTINELS\""
123+
JQ_FILTERS_CONFIG="$JQ_FILTERS_CONFIG | .utapi.redis.name=\"$REDIS_HA_NAME\""
124+
JQ_FILTERS_CONFIG="$JQ_FILTERS_CONFIG | .utapi.redis.sentinels=\"$REDIS_SENTINELS\""
125125
elif [[ "$REDIS_HA_HOST" ]]; then
126-
JQ_FILTERS_CONFIG="$JQ_FILTERS_CONFIG | .redis.host=\"$REDIS_HA_HOST\""
127-
JQ_FILTERS_CONFIG="$JQ_FILTERS_CONFIG | .redis.port=6379"
126+
JQ_FILTERS_CONFIG="$JQ_FILTERS_CONFIG | .utapi.redis.host=\"$REDIS_HA_HOST\""
127+
JQ_FILTERS_CONFIG="$JQ_FILTERS_CONFIG | .utapi.redis.port=6379"
128128
fi
129129

130130
if [[ "$REDIS_HA_PORT" ]] && [[ ! "$REDIS_SENTINELS" ]]; then
131-
JQ_FILTERS_CONFIG="$JQ_FILTERS_CONFIG | .redis.port=$REDIS_HA_PORT"
131+
JQ_FILTERS_CONFIG="$JQ_FILTERS_CONFIG | .utapi.redis.port=$REDIS_HA_PORT"
132132
fi
133133

134134
if [[ "$RECORDLOG_ENABLED" ]]; then

lib/Config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1298,7 +1298,10 @@ class Config extends EventEmitter {
12981298
}
12991299

13001300
if (config.redis) {
1301-
this.redis = parseRedisConfig(config.redis);
1301+
// Fail fast to make sure we detect any bad config
1302+
throw new Error(
1303+
'config.redis is not supported anymore: it should be config.utapi.redis or config.localCache'
1304+
);
13021305
}
13031306
if (config.scuba) {
13041307
this.scuba = {};

lib/utapi/utapi.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ const { utapiVersion, UtapiServer: utapiServer } = require('utapi');
44

55
// start utapi server
66
if (utapiVersion === 1 && _config.utapi) {
7-
const fullConfig = Object.assign({}, _config.utapi,
8-
{ redis: _config.redis });
7+
const fullConfig = Object.assign({}, _config.utapi);
98
if (_config.vaultd) {
109
Object.assign(fullConfig, { vaultd: _config.vaultd });
1110
}

lib/utapi/utapiReplay.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ require('werelogs').stderrUtils.catchAndTimestampStderr();
22
const UtapiReplay = require('utapi').UtapiReplay;
33
const _config = require('../Config').config;
44

5-
const utapiConfig = _config.utapi &&
6-
Object.assign({}, _config.utapi, { redis: _config.redis });
5+
const utapiConfig = _config.utapi && Object.assign({}, _config.utapi);
76
const replay = new UtapiReplay(utapiConfig); // start utapi server
87
replay.start();

lib/utapi/utilities.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,7 @@ const { suppressedUtapiEventFields: suppressedEventFields } = require('../../con
1010
let utapiConfig;
1111

1212
if (utapiVersion === 1 && _config.utapi) {
13-
if (_config.utapi.redis === undefined) {
14-
utapiConfig = Object.assign({}, _config.utapi, { redis: _config.redis });
15-
} else {
16-
utapiConfig = Object.assign({}, _config.utapi);
17-
}
13+
utapiConfig = Object.assign({}, _config.utapi);
1814
} else if (utapiVersion === 2) {
1915
utapiConfig = Object.assign({
2016
tls: _config.https,

tests/unit/Config.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -628,10 +628,6 @@ describe('Config', () => {
628628
it('should set up utapi redis', () => {
629629
const config = new ConfigObject();
630630

631-
assert.deepStrictEqual(
632-
config.redis,
633-
{ name: 'zenko', sentinels: [{ host: 'localhost', port: 6379 }] },
634-
);
635631
assert.deepStrictEqual(
636632
config.utapi.redis,
637633
{

tests/unit/testConfigs/allOptsConfig/config.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,6 @@
9696
"name": "zenko",
9797
"sentinels": "localhost:6379"
9898
},
99-
"redis": {
100-
"name": "zenko",
101-
"sentinels": "localhost:6379"
102-
},
10399
"scuba": {
104100
"host": "localhost",
105101
"port": 8100

0 commit comments

Comments
 (0)