@apolitical/server 2.7.0-rc.3 → 2.7.0-rc.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apolitical/server",
3
- "version": "2.7.0-rc.3",
3
+ "version": "2.7.0-rc.4",
4
4
  "description": "Node.js module to encapsulate Apolitical's express server setup",
5
5
  "author": "Apolitical Group Limited <engineering@apolitical.co>",
6
6
  "license": "MIT",
@@ -2,12 +2,15 @@
2
2
 
3
3
  module.exports =
4
4
  ({ qs, jwtEncodeHelper, config }) =>
5
- ({ sessionSecret }) => {
5
+ ({ sessionSecret = null } = {}) => {
6
6
  const {
7
7
  APOLITICAL: { ISSUER, ADMIN_ROLE, COOKIE_KEY },
8
8
  } = config.JWT;
9
9
 
10
10
  function generateAdminToken() {
11
+ if (!sessionSecret) {
12
+ throw new Error('Cannot generate token without session secret');
13
+ }
11
14
  const token = jwtEncodeHelper(sessionSecret, {
12
15
  role: ADMIN_ROLE,
13
16
  admin: true,