Skip to content

Conversation

albertopq
Copy link
Collaborator

No description provided.

Copy link
Member

@ferjm ferjm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you Alberto!

LGTM, but we need to fix the small thing about the credentials header.

src/config.js Outdated

const remoteSTConfig = {
server: {
doc: 'SensorThings sandbox API server',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: if we use something different to SensorUp, this might not be a sandbox anymore :)

src/config.js Outdated
default: 'https://pg-api.sensorup.com'
},
path: {
doc: 'SensorThings sandbox API path',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto.

src/config.js Outdated
},
credentials: {
token: {
doc: 'SensorThings sandbox API credentials',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto.

* You will need to get an access token by creating an account at
* https://pg.sensorup.com/playground.html
*
* Add the access token to your 'sandboxToken' config file entry.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe reword this comment to explain that we use SensorUp's for now, but this code is ready to proxy to other ST external services. Also, a comment at the top of the file explaining the local vs remote choices might be helpful.

},
decorateRequest: (proxyReq, originalReq) => {
// Add SensorUp auth header.
proxyReq.headers['St-P-Access-Token'] = config.get('sensorthings.remote.credentials.token');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This header is specific to SensorUp. Maybe we need to add a config option for this. Let's keep it simple for now and assume that an external ST service only takes its credentials through a header:

credentials: {
  header: 'St-P-Access-Token',
  value: 'token'
}

@albertopq albertopq force-pushed the st-proxy branch 2 times, most recently from 57287b3 to 4dc5d98 Compare October 20, 2016 10:16
@ferjm
Copy link
Member

ferjm commented Oct 20, 2016

Looks good! It seems that you need to tweak the tests config file though.

Copy link
Member

@ferjm ferjm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make the tests green again and feel free to merge. Thanks!

@coveralls
Copy link

Coverage Status

Coverage decreased (-1.1%) to 88.095% when pulling 51e724d on albertopq:st-proxy into 49837e4 on mozilla-sensorweb:master.

@ferjm ferjm merged commit 1fe558e into mozilla-sensorweb:master Oct 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants