Security News
Bun 1.2 Released with 90% Node.js Compatibility and Built-in S3 Object Support
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Creates a clone of the http class that signs each request before its sent.
Usage:
var elasticsearch = require('elasticsearch');
require('aws_es')(elasticsearch);
var client = new elasticsearch.Client({
host : 'xxxxx.es.amazonaws.com',
amazonES: {
region : 'us-east-1',
accessKey : 'XXXX',
secretKey : 'XXXX'
}
})
Config variables service
, region
, accessKey
and secretKey
can be defined in an amazonES
object at client creation. Alternatively, service defaults to 'es', region defaults to 'us-east-1' and the keys default to environment variables: AWS_ACCESS_KEY_ID
and AWS_SECRET_ACCESS_KEY
The complete code is as follows:
var aws4 = require('aws4');
module.exports = function(es) {
var pool = es.ConnectionPool,
http = pool.connectionClasses.http;
var aws = function() { http.apply(this,arguments); };
require('util').inherits(aws,http);
aws.prototype.createAgent = function(config) {
this._amazonES = config.amazonES || {};
http.prototype.createAgent.call(this,config);
};
aws.prototype.request = function(params) {
var config = this._amazonES;
params.service = config.service || 'es';
params.region = config.region || 'us-east-1';
params.headers = {'Content-Type' : 'application/json'};
aws4.sign(params,{
accessKeyId: config.accessKey || process.env.AWS_ACCESS_KEY_ID,
secretAccessKey: config.secretKey || process.env.AWS_SECRET_ACCESS_KEY
});
return http.prototype.request.apply(this,arguments);
};
pool.defaultConnectionClass = 'aws';
pool.connectionClasses.aws = aws;
return es;
};
FAQs
Creates a clone of the http class that signs each request before its sent.
The npm package aws_es receives a total of 4 weekly downloads. As such, aws_es popularity was classified as not popular.
We found that aws_es demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.