hof 20.1.2-redis-beta.0 → 20.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -16,7 +16,7 @@ jobs:
16
16
  fetch-depth: 0
17
17
  - uses: actions/setup-node@v1
18
18
  with:
19
- node-version: 14
19
+ node-version: 10
20
20
  registry-url: https://registry.npmjs.org/
21
21
  - name: 'Get Previous tag'
22
22
  id: previoustag
@@ -7,7 +7,7 @@ jobs:
7
7
  runs-on: ubuntu-latest
8
8
  strategy:
9
9
  matrix:
10
- node-version: [14.x]
10
+ node-version: [10.x, 12.x, 14.x]
11
11
  redis-version: [4, 5, 6]
12
12
  steps:
13
13
  - uses: actions/checkout@v2.2.0
@@ -34,7 +34,7 @@ jobs:
34
34
  - uses: actions/checkout@v2.2.0
35
35
  - uses: actions/setup-node@v1
36
36
  with:
37
- node-version: 14
37
+ node-version: 10
38
38
  registry-url: https://registry.npmjs.org/
39
39
  - run: |
40
40
  git config --local user.email "$(git log --format='%ae' HEAD^!)"
@@ -52,7 +52,7 @@ jobs:
52
52
  - uses: actions/checkout@v2.2.0
53
53
  - uses: actions/setup-node@v1
54
54
  with:
55
- node-version: 14
55
+ node-version: 10
56
56
  registry-url: https://registry.npmjs.org/
57
57
  - run: |
58
58
  git config --local user.email "$(git log --format='%ae' HEAD^!)"
@@ -70,7 +70,7 @@ jobs:
70
70
  - uses: actions/checkout@v2.2.0
71
71
  - uses: actions/setup-node@v1
72
72
  with:
73
- node-version: 14
73
+ node-version: 10
74
74
  registry-url: https://registry.npmjs.org/
75
75
  - run: |
76
76
  git config --local user.email "$(git log --format='%ae' HEAD^!)"
@@ -25,6 +25,7 @@ This allows you to specify fields to loop over and add as objects to a parent ar
25
25
  ],
26
26
  removePrefix: 'storage-',
27
27
  combineValuesToSingleField: 'address',
28
+ groupOptional: true,
28
29
  returnTo: '/add-address'
29
30
  }),
30
31
  next: '/confirm'
@@ -35,5 +36,6 @@ Here are the fields you call this behaviour first to set config for it:
35
36
  `fieldsToGroup`: (Required) the fields being specified for an object, e.g. house number, street, postcode, that are grouped together,
36
37
  `removePrefix`: (Optional) a string which is used to remove consistent prefixes from a collection of fields that are grouped together,
37
38
  `combineValuesToSingleField`: (Optional) a new field that is created with its value being the concatenation of values of the fields specified in `fieldsToGroup`,
38
- `returnTo`: the next step if you want to add another object to this group
39
+ `groupOptional`: (Optional) set this to true if you want to land on the radio button question if all records in the group are deleted after creation,
40
+ `returnTo`: (Required) the next step if you want to add another object to this group
39
41
  ```
@@ -5,7 +5,7 @@ const path = require('path');
5
5
  const express = require('express');
6
6
 
7
7
  module.exports = config => {
8
- const { returnTo, groupName, fieldsToGroup, combineValuesToSingleField, removePrefix } = config;
8
+ const { returnTo, groupName, fieldsToGroup, combineValuesToSingleField, removePrefix, groupOptional } = config;
9
9
 
10
10
  if (removePrefix && typeof removePrefix !== 'string') {
11
11
  throw new Error('removePrefix is a string and is optional for loops');
@@ -71,7 +71,7 @@ module.exports = config => {
71
71
  });
72
72
  }
73
73
 
74
- const target = items.length ? req.form.options.route : returnTo;
74
+ const target = (items.length || groupOptional) ? req.form.options.route : returnTo;
75
75
  const action = req.params.action || '';
76
76
  res.redirect(path.join(req.baseUrl, target, action));
77
77
  }
@@ -84,7 +84,10 @@ module.exports = config => {
84
84
  validate: ['required'],
85
85
  options: [
86
86
  'yes', 'no'
87
- ]
87
+ ],
88
+ legend: {
89
+ className: 'visuallyhidden'
90
+ }
88
91
  }, req.form.options.fieldSettings);
89
92
 
90
93
  // add conditonal fork
@@ -95,9 +98,6 @@ module.exports = config => {
95
98
  condition: {
96
99
  field: field,
97
100
  value: 'yes'
98
- },
99
- legend: {
100
- className: 'visuallyhidden'
101
101
  }
102
102
  });
103
103
  next();
@@ -27,8 +27,7 @@ const defaults = {
27
27
  ignoreMiddlewareLogs: ['/healthz'],
28
28
  redis: {
29
29
  port: process.env.REDIS_PORT || '6379',
30
- host: process.env.REDIS_HOST || '127.0.0.1',
31
- legacyMode: true
30
+ host: process.env.REDIS_HOST || '127.0.0.1'
32
31
  },
33
32
  session: {
34
33
  ttl: process.env.SESSION_TTL || 1800,
package/lib/health.js CHANGED
@@ -15,7 +15,7 @@ module.exports = redis => {
15
15
 
16
16
  router.get('/readiness', healthCheck({
17
17
  test: () => {
18
- if (!redis.isOpen && !redis.isReady) {
18
+ if (!redis.connected && !redis.ready) {
19
19
  return new Error('Session store unhealthy');
20
20
  }
21
21
  return 0;
package/lib/sessions.js CHANGED
@@ -50,7 +50,7 @@ module.exports = (app, config) => {
50
50
  logger.error(e);
51
51
  });
52
52
  }
53
- client.connect();
53
+
54
54
  const store = new RedisStore({
55
55
  client: client,
56
56
  ttl: config.session.ttl,
@@ -25,11 +25,9 @@ module.exports = (options, rateLimitType) => {
25
25
  }
26
26
 
27
27
  const closeConnection = async err => {
28
- await redisClient.v4.QUIT();
28
+ await redisClient.quit();
29
29
  return next(err);
30
30
  };
31
- redisClient.on('error', err => logger.log('error', err));
32
- await redisClient.connect();
33
31
 
34
32
  try {
35
33
  // fetch records of current user using IP address, returns null when no record is found
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hof",
3
3
  "description": "A bootstrap for HOF projects",
4
- "version": "20.1.2-redis-beta.0",
4
+ "version": "20.1.3",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
7
7
  "author": "HomeOffice",
@@ -42,7 +42,7 @@
42
42
  "callsite": "^1.0.0",
43
43
  "chalk": "^2.0.0",
44
44
  "chokidar": "^3.4.0",
45
- "connect-redis": "^6.1.3",
45
+ "connect-redis": "^5.2.0",
46
46
  "cookie-parser": "^1.4.6",
47
47
  "cp": "^0.2.0",
48
48
  "csrf": "^3.0.2",
@@ -80,7 +80,7 @@
80
80
  "nodemailer-smtp-transport": "^2.7.4",
81
81
  "nodemailer-stub-transport": "^1.1.0",
82
82
  "notifications-node-client": "^5.1.1",
83
- "redis": "^4.3.1",
83
+ "redis": "^3.1.2",
84
84
  "reqres": "^3.0.1",
85
85
  "request": "^2.79.0",
86
86
  "rimraf": "^3.0.2",