diff --git a/README.md b/README.md index f66a098..932c75c 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,14 @@ Allows you to prefix your keys if you want all of your snapshots to live in a sp default: none +#### AWS_ENDPOINT_URL + +Use of a S3 endpoint URL different from the default one. + +`export AWS_ENDPOINT_URL=s3.domain.tld` + +default: s3.amazonaws.com + ## License The MIT License (MIT) diff --git a/index.js b/index.js index 6038d8b..2d054b7 100644 --- a/index.js +++ b/index.js @@ -1,4 +1,11 @@ -var s3 = new (require('aws-sdk')).S3({params:{Bucket: process.env.S3_BUCKET_NAME}}); +const AWS = require('aws-sdk'); + +let options = {params:{Bucket: process.env.S3_BUCKET_NAME}}; +if (process.env.AWS_ENDPOINT_URL) { + let ep = new AWS.Endpoint(process.env.AWS_ENDPOINT_URL); + options.endpoint = ep; +} +let s3 = new AWS.S3(options); module.exports = {