Skip to content

Commit

Permalink
Merge pull request #9 from sat-utils/sign4
Browse files Browse the repository at this point in the history
Sign4 Support
  • Loading branch information
drewbo authored Jan 13, 2017
2 parents 9a6b5c9 + 8a6fdff commit a5510b5
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
4 changes: 2 additions & 2 deletions libs/queries.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ module.exports = function (params) {

// select parameters that have _from or _to
_.forEach(params, function (value, key) {
var field = _.replace(key, '_from', '');
field = _.replace(field, '_to', '');
var field = key.replace('_from', '');
field = field.replace('_to', '');

if (key === 'cloud_from' || key === 'cloud_to') {
rangeFields['cloud'] = {
Expand Down
16 changes: 14 additions & 2 deletions libs/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,24 @@ var logger = require('./logger');
var queries = require('./queries');
var aggregations = require('./aggregations');

var client = new elasticsearch.Client({
var esConfig = {
host: process.env.ES_HOST || 'localhost:9200',

// Note that this doesn't abort the query.
requestTimeout: 50000 // milliseconds
});
}

// use AWS Sing4 if aws-access-key is provided
if (_.has(process.env, 'AWS_ACCESS_KEY_ID') && _.has(process.env, 'AWS_SECRET_ACCESS_KEY')) {
esConfig.connectionClass = require('http-aws-es');
esConfig.amazonES = {
region: process.env.AWS_DEFAULT_REGION || 'us-east-1',
accessKey: process.env.AWS_ACCESS_KEY_ID,
secretKey: process.env.AWS_SECRET_ACCESS_KEY
}
}

var client = new elasticsearch.Client(esConfig);

// converts string intersect to js object
var intersectsToObj = function (intersects) {
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sat-api-lib",
"version": "0.4.1",
"version": "0.5.0",
"description": "A library for creating a search API of public Satellites metadata using Elasticsearch",
"main": "index.js",
"scripts": {
Expand All @@ -19,6 +19,7 @@
"dependencies": {
"elasticsearch": "^11.0.1",
"geojson-validation": "^0.1.6",
"http-aws-es": "^1.1.3",
"lodash": "^4.12.0",
"moment": "^2.15.1",
"turf-area": "^3.0.1",
Expand Down

0 comments on commit a5510b5

Please sign in to comment.