Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit b0b1044

Browse files
Made bucket name variable
1 parent 2173d23 commit b0b1044

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

‎README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
# netlify-spaces
2+
23
Netlify functions for working with Amazon S3/Digitalocean Spaces
34

45
## How To:
56

6-
77
### 1. Deploy this repo to Netlify
8+
89
Deploy this repo to Netlify using the 'Deploy to Netlify'-button below:
910

1011
<a href="https://app.netlify.com/start/deploy?repository=https://github.com/dashpilot/quickstart-netlify-spaces"><img src="https://www.netlify.com/img/deploy/button.svg" /></a>
1112

12-
### 2. Add three environment variables
13+
### 2. Add your S3 credentials as environment variables
1314

1415
In Netlify, go to settings > environment and create the following environment variables for your Amazon S3 or Digitalocean Spaces settings
1516

1617
`S3_ENDPOINT`: your S3/Spaces endpoint (e.g ams3.digitaloceanspaces.com)\
1718
`S3_KEY`: your S3/Spaces key\
1819
`S3_SECRET`: your S3/Spaces secret
20+
`S3_BUCKET`: your S3/Spaces bucket

‎functions/save.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ exports.handler = function(event, context, callback) {
2727
let filename = "data.json";
2828
var params = {
2929
Body: JSON.stringify(jsondata.data),
30-
Bucket: "netlify-spaces",
30+
Bucket: process.env.S3_BUCKET,
3131
Key: filename,
3232
ContentType: "application/json",
3333
ACL: "public-read",
@@ -40,7 +40,7 @@ exports.handler = function(event, context, callback) {
4040
".jpg";
4141
var params = {
4242
Body: JSON.stringify(jsondata.data),
43-
Bucket: "netlify-spaces",
43+
Bucket: process.env.S3_BUCKET,
4444
Key: filename,
4545
ContentType: "image/jpeg",
4646
ACL: "public-read",

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /