Skip to content

Commit 130510f

Browse files
tmocellinflovilmart
authored andcommitted
add digital ocean spaces config section (#543)
1 parent e83e8e4 commit 130510f

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

_includes/parse-server/file-adapters.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,46 @@ var api = new ParseServer({
164164
});
165165
```
166166

167+
##### S3Adapter configuration for Digital Ocean Spaces
168+
169+
Spaces is an S3 equivalent prodivided by Digital Ocean. It's use the same api as S3 so you can use it with the S3 Adapter.
170+
You just need to change the AWS Endpoint to point to your Spaces endpoint.
171+
172+
```javascript
173+
...
174+
var S3Adapter = require('parse-server').S3Adapter;
175+
var AWS = require("aws-sdk");
176+
177+
//Set Digital Ocean Spaces EndPoint
178+
const spacesEndpoint = new AWS.Endpoint(process.env.SPACES_ENDPOINT);
179+
//Define S3 options
180+
var s3Options = {
181+
bucket: process.env.SPACES_BUCKET_NAME,
182+
baseUrl: process.env.SPACES_BASE_URL,
183+
region: process.env.SPACES_REGION,
184+
directAccess: true,
185+
globalCacheControl: "public, max-age=31536000",
186+
bucketPrefix: process.env.SPACES_BUCKET_PREFIX,
187+
s3overrides: {
188+
accessKeyId: process.env.SPACES_ACCESS_KEY,
189+
secretAccessKey: process.env.SPACES_SECRET_KEY,
190+
endpoint: spacesEndpoint
191+
}
192+
};
193+
194+
var s3Adapter = new S3Adapter(s3Options);
195+
196+
var api = new ParseServer({
197+
databaseURI: databaseUri || 'mongodb://localhost:27017/dev',
198+
appId: process.env.APP_ID || 'APPLICATION_ID',
199+
masterKey: process.env.MASTER_KEY || 'MASTER_KEY',
200+
...
201+
filesAdapter: s3Adapter
202+
...
203+
});
204+
```
205+
206+
167207
##### GCSAdapter constructor options
168208

169209
```js

0 commit comments

Comments
 (0)