Skip to content

Commit

Permalink
Api: Fix cors config being required to start
Browse files Browse the repository at this point in the history
This makes the cors config table entirely optional, instead
of previously just the origins key inside the cors table

Resolves #331
  • Loading branch information
networkException committed Apr 5, 2021
1 parent 19513a0 commit 89aef81
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion api.js
Expand Up @@ -144,7 +144,7 @@ if (config.api.secure && certOptions.key) {
const server = restify.createServer(serverOptions);

const cors = corsMiddleware({
origins: [].concat(config.api.cors.origins || ['*']),
origins: [].concat((config.api.cors && config.api.cors.origins) ? config.api.cors.origins : ['*']),
allowHeaders: ['X-Access-Token'],
allowCredentialsAllOrigins: true
});
Expand Down

0 comments on commit 89aef81

Please sign in to comment.