Skip to content

Commit

Permalink
Update settings
Browse files Browse the repository at this point in the history
  • Loading branch information
pinzon authored Nov 22, 2023
2 parents 3ba33f3 + 64a5841 commit 1f833b8
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,14 @@ amplify push --use-localstack true
### Configuration
The following environment variables can be configured:

* `EDGE_PORT`: Port under which LocalStack edge service is accessible (default: `4566`)
* `LOCALSTACK_HOSTNAME`: Target host under which LocalStack edge service is accessible (default: `localhost.localstack.cloud`)
* `LOCALSTACK_ENDPOINT`: Sets a custom endpoint directly. Overrides `EDGE_PORT` and `LOCALSTACK_HOSTNAME` (default `https://localhost.localstack.cloud:4566`)
* `LOCALSTACK_ACCESS_KEY_ID`: Sets custom Access Key Id for the internal client to use (default `test`).
* `LOCALSTACK_ACCESS_KEY_SECRET`: Sets custom Access Key Secret for the internal client to use (default `test`).
* `LOCALSTACK_REGION`: Sets a custom region (default `us-east-1`).
* `LOCALSTACK_S3_FORCE_PATH_STYLE`: Sets the S3 path style (default `1`, accepted values: `1`as true and `0` as false)).
* `LOCALSTACK_ENDPOINT`: Sets a custom endpoint (default `https://localhost.localstack.cloud:4566`).

## Change Log
* 0.3.0: more and up to date settings
* 0.2.5: patch AWS-SDK Config
* 0.2.4: add missing handlers
* 0.2.3: fix paths for patching
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "amplify-localstack",
"version": "0.2.5",
"version": "0.2.6",
"description": "",
"main": "index.js",
"scripts": {
Expand Down
12 changes: 5 additions & 7 deletions patches.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ const AWS_DEFAULT_REGION = 'us-east-1'
// const snapshotPath = '/snapshot/repo/build/node_modules/'
const snapshotPath = '/snapshot/amplify-cli/build/node_modules/'
const getLocalEndpoint = () => {
const port = process.env.EDGE_PORT || DEFAULT_EDGE_PORT
const host = process.env.LOCALSTACK_HOSTNAME || DEFAULT_HOSTNAME
return process.env.LOCALSTACK_ENDPOINT || `https://${host}:${port}`
return process.env.LOCALSTACK_ENDPOINT || `https://${DEFAULT_HOSTNAME}:${DEFAULT_EDGE_PORT}`
}

// Patchs the awscloudformation provider plugin to deploy the resources into LocalStack
Expand All @@ -25,10 +23,10 @@ const patchConfigManagerLoader = (context) => {
sysConfigManager.loadConfiguration = () => {
const config = {}
config.endpoint = getLocalEndpoint()
config.accessKeyId = AWS_ACCESS_KEY_ID
config.secretAccessKey = AWS_SECRET_ACCESS_KEY
config.s3ForcePathStyle = true
config.region = AWS_DEFAULT_REGION
config.accessKeyId = process.env.LOCALSTACK_ACCESS_KEY_ID || AWS_ACCESS_KEY_ID
config.secretAccessKey = process.env.LOCALSTACK_ACCESS_KEY_SECRET || AWS_SECRET_ACCESS_KEY
config.s3ForcePathStyle = process.env.LOCALSTACK_S3_FORCE_PATH_STYLE !== '0'
config.region = process.env.LOCALSTACK_REGION || AWS_DEFAULT_REGION
return config
}
} catch (error) {
Expand Down

0 comments on commit 1f833b8

Please sign in to comment.