serverless-localstack
Advanced tools
Comparing version 1.1.1 to 1.1.2
{ | ||
"name": "serverless-localstack", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "Connect Serverless to LocalStack!", | ||
@@ -22,9 +22,9 @@ "main": "src/index.js", | ||
"LocalStack Team <info@localstack.cloud>", | ||
"Waldemar Hummer (whummer)", | ||
"Ben Simon Hartung (bentsku)", | ||
"Joel Scheuner (joe4dev)", | ||
"temyers", | ||
"Waldemar Hummer (whummer)", | ||
"Justin McCormick <me@justinmccormick.com>", | ||
"djKooks", | ||
"yohei1126", | ||
"bentsku", | ||
"Joel Scheuner (joe4dev)" | ||
"yohei1126" | ||
], | ||
@@ -31,0 +31,0 @@ "license": "MIT", |
@@ -66,4 +66,6 @@ [![Build Status](https://travis-ci.org/localstack/serverless-localstack.svg?branch=master)](https://travis-ci.org/localstack/serverless-localstack) | ||
The following environment variables can be configured (taking precedence over the values in `serverless.yml`): | ||
* `EDGE_PORT`: LocalStack edge port to connect to (default: `4566`) | ||
* `LOCALSTACK_HOSTNAME`: LocalStack host name to connect to (default: `localhost`) | ||
* `AWS_ENDPOINT_URL`: LocalStack endpoint URL to connect to (default: `http://localhost:4566`). This is the recommended configuration, and replaces the deprecated config options (`EDGE_PORT`/`LOCALSTACK_HOSTNAME`/`USE_SSL`) below. | ||
* `EDGE_PORT`: LocalStack edge port to connect to (deprecated; default: `4566`) | ||
* `LOCALSTACK_HOSTNAME`: LocalStack host name to connect to (deprecated; default: `localhost`) | ||
* `USE_SSL`: Whether to use SSL/HTTPS when connecting to the LocalStack endpoint (deprecated) | ||
@@ -210,2 +212,3 @@ ### Activating the plugin for certain stages | ||
* v1.1.2: Unify construction of target endpoint URL, add support for configuring `AWS_ENDPOINT_URL` | ||
* v1.1.1: Fix layer deployment if `mountCode` is enabled by always packaging and deploying | ||
@@ -212,0 +215,0 @@ * v1.1.0: Fix SSM environment variables resolving issues with serverless v3, change default for `BUCKET_MARKER_LOCAL` to `hot-reload` |
@@ -556,3 +556,3 @@ 'use strict'; | ||
slsSecretsAWS.config.options.providerOptions = slsSecretsAWS.config.options.providerOptions || {}; | ||
slsSecretsAWS.config.options.providerOptions.endpoint = this.getServiceURL('ssm'); | ||
slsSecretsAWS.config.options.providerOptions.endpoint = this.getServiceURL(); | ||
slsSecretsAWS.config.options.providerOptions.accessKeyId = 'test'; | ||
@@ -574,4 +574,3 @@ slsSecretsAWS.config.options.providerOptions.secretAccessKey = 'test'; | ||
const hostname = await this.getConnectHostname(); | ||
const host = `http://${hostname}`; | ||
const edgePort = this.getEdgePort(); | ||
const configChanges = {}; | ||
@@ -596,3 +595,3 @@ | ||
// If a host has been configured, override each service | ||
const localEndpoint = `${host}:${edgePort}`; | ||
const localEndpoint = this.getServiceURL(hostname); | ||
for (const service of this.awsServices) { | ||
@@ -764,7 +763,32 @@ const serviceLower = service.toLowerCase(); | ||
getServiceURL() { | ||
getServiceURL(hostname) { | ||
if (process.env.AWS_ENDPOINT_URL) { | ||
return this.injectHostnameIntoLocalhostURL(process.env.AWS_ENDPOINT_URL, hostname); | ||
} | ||
hostname = hostname || 'localhost'; | ||
const proto = TRUE_VALUES.includes(process.env.USE_SSL) ? 'https' : 'http'; | ||
return `${proto}://localhost:${this.getEdgePort()}`; | ||
const port = this.getEdgePort(); | ||
// little hack here - required to remove the default HTTPS port 443, as otherwise | ||
// routing for some platforms and ephemeral instances (e.g., on namespace.so) fails | ||
const isDefaultPort = | ||
(proto === 'http' && `${port}` === '80') || | ||
(proto === 'https' && `${port}` === '443'); | ||
if (isDefaultPort) { | ||
return `${proto}://${hostname}`; | ||
} | ||
return `${proto}://${hostname}:${port}`; | ||
} | ||
/** | ||
* If the given `endpointURL` points to `localhost`, then inject the given `hostname` into the URL | ||
* and return it. This helps fix IPv6 issues with node v18+ (see also getConnectHostname() above) | ||
*/ | ||
injectHostnameIntoLocalhostURL(endpointURL, hostname) { | ||
const url = new URL(endpointURL); | ||
if (hostname && url.hostname === 'localhost') { | ||
url.hostname = hostname; | ||
} | ||
return url.href; | ||
} | ||
log(msg) { | ||
@@ -793,3 +817,3 @@ if (this.serverless.cli) { | ||
if (plugin) { | ||
const endpoint = this.getServiceURL() | ||
const endpoint = this.getServiceURL(); | ||
plugin.originalDisplay = plugin.display; | ||
@@ -796,0 +820,0 @@ plugin.localstackEndpoint = endpoint; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
78544
21
1777
252
3
17