Improves documentation, add loading tests

This commit is contained in:
Florent Vilmart
2016-03-04 12:04:41 -05:00
parent 069605e9c3
commit a44b1d9f76
3 changed files with 40 additions and 1 deletions

View File

@@ -135,6 +135,20 @@ PARSE_SERVER_MAX_UPLOAD_SIZE
```
##### Configuring S3 Adapter
You can use the following environment variable setup the S3 adapter
```js
S3_ACCESS_KEY
S3_SECRET_KEY
S3_BUCKET
S3_REGION
S3_BUCKET_PREFIX
S3_DIRECT_ACCESS
```
## Contributing
We really want Parse to be yours, to see it grow and thrive in the open source community. Please see the [Contributing to Parse Server guide](CONTRIBUTING.md).

View File

@@ -1,6 +1,8 @@
var loadAdapter = require("../src/Adapters/AdapterLoader").loadAdapter;
var FilesAdapter = require("../src/Adapters/Files/FilesAdapter").default;
var ParsePushAdapter = require("../src/Adapters/Push/ParsePushAdapter");
var S3Adapter = require("../src/Adapters/Files/S3Adapter").default;
describe("AdapterLoader", ()=>{
@@ -84,4 +86,27 @@ describe("AdapterLoader", ()=>{
}).not.toThrow("foo is required for that adapter");
done();
});
it("should load push adapter from options", (done) => {
var options = {
ios: {
bundleId: 'bundle.id'
}
}
expect(() => {
var adapter = loadAdapter(undefined, ParsePushAdapter, options);
expect(adapter.constructor).toBe(ParsePushAdapter);
expect(adapter).not.toBe(undefined);
}).not.toThrow();
done();
});
it("should load S3Adapter from direct passing", (done) => {
var s3Adapter = new S3Adapter("key", "secret", "bucket")
expect(() => {
var adapter = loadAdapter(s3Adapter, FilesAdapter);
expect(adapter).toBe(s3Adapter);
}).not.toThrow();
done();
})
});

View File

@@ -29,7 +29,7 @@ export function loadAdapter(adapter, defaultAdapter, options) {
} else if (adapter.adapter) {
return loadAdapter(adapter.adapter, undefined, adapter.options);
}
// return the adapter as is as it's unusable otherwise
// return the adapter as provided
return adapter;
}