Skip to content

Commit

Permalink
Merge pull request #67 from nzzdev/release-2.3.0
Browse files Browse the repository at this point in the history
Release 2.3.0
  • Loading branch information
benib committed Jun 27, 2017
2 parents e22ce10 + 2fa2920 commit c109009
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
4 changes: 4 additions & 0 deletions docs/about-targets.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ const tools = {
demo2: {
path: '/rendering-info/html-static',
//...
},
demo3: {
url: 'https://some-other-service.example.com/rendering-info', // you can use url to use an external service providing the rendering information
//...
}
}
//...
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nzz/q-server",
"version": "2.2.0",
"version": "2.3.0",
"description": "",
"main": "index.js",
"scripts": {
Expand Down
10 changes: 9 additions & 1 deletion processing/rendering-info-fetcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ function getRenderingInfo(data, target, toolRuntimeConfig) {

const baseUrl = server.settings.app.tools.get(`/${toolName}/baseUrl`, { target: target })
const endpoint = server.settings.app.tools.get(`/${toolName}/endpoint`, { target: target })
let requestUrl;
if (endpoint.hasOwnProperty('path')) {
requestUrl = `${baseUrl}${endpoint.path}`;
} else if (endpoint.hasOwnProperty('url')) {
requestUrl = endpoint.url;
} else {
throw new Error('Endpoint has no path nor url configured');
}

// add _id, createdDate and updatedDate as query params to rendering info request
let queryParams = ['_id', 'createdDate', 'updatedDate'];
Expand All @@ -38,7 +46,7 @@ function getRenderingInfo(data, target, toolRuntimeConfig) {
toolRuntimeConfig: toolRuntimeConfig
}

return fetch(`${baseUrl}${endpoint.path}?${queryString}`, {
return fetch(`${requestUrl}?${queryString}`, {
method: 'POST',
body: JSON.stringify(body),
headers: {
Expand Down

0 comments on commit c109009

Please sign in to comment.