Improves documentation, add loading tests
This commit is contained in:
14
README.md
14
README.md
@@ -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
|
## 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).
|
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).
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
|
|
||||||
var loadAdapter = require("../src/Adapters/AdapterLoader").loadAdapter;
|
var loadAdapter = require("../src/Adapters/AdapterLoader").loadAdapter;
|
||||||
var FilesAdapter = require("../src/Adapters/Files/FilesAdapter").default;
|
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", ()=>{
|
describe("AdapterLoader", ()=>{
|
||||||
|
|
||||||
@@ -84,4 +86,27 @@ describe("AdapterLoader", ()=>{
|
|||||||
}).not.toThrow("foo is required for that adapter");
|
}).not.toThrow("foo is required for that adapter");
|
||||||
done();
|
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();
|
||||||
|
})
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ export function loadAdapter(adapter, defaultAdapter, options) {
|
|||||||
} else if (adapter.adapter) {
|
} else if (adapter.adapter) {
|
||||||
return loadAdapter(adapter.adapter, undefined, adapter.options);
|
return loadAdapter(adapter.adapter, undefined, adapter.options);
|
||||||
}
|
}
|
||||||
// return the adapter as is as it's unusable otherwise
|
// return the adapter as provided
|
||||||
return adapter;
|
return adapter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user