Create custom local providers

This commit is contained in:
Jim LAURIE 2019-10-23 10:51:51 +02:00
parent 7fd4e2fd45
commit db8fa6fd5d
2 changed files with 46 additions and 0 deletions

View File

@ -88,3 +88,26 @@ In the `send` function you will have access to:
- `config` that contain configuration you setup in your admin panel
- `options` that contain option your send when you called the `send` function from the email plugin service
To use it you will have to publish it on **npm**.
### Create a local provider
If you want create your own provider without publishing it on **npm** you can follow these following steps:
- You create a `providers` folder in your application.
- Create your provider as explain in the documentation eg. `./providers/strapi-provider-email-[...]/...`
- Then update your `package.json` to link your `strapi-provider-email-[...]` dependency to the [local path](https://docs.npmjs.com/files/package.json#local-paths) of your new provider.
```json
{
...
"dependencies": {
...
"strapi-provider-email-[...]": "file:providers/strapi-provider-email-[...]",
...
}
}
```
- Finally, run `yarn install` or `npm install` to install your new custom provider.

View File

@ -293,3 +293,26 @@ Then, visit [http://localhost:1337/admin/plugins/upload/configurations/developme
## Create providers
If you want to create your own, make sure the name starts with `strapi-provider-upload-` (duplicating an existing one will be easier to create), modify the `auth` config object and customize the `upload` and `delete` functions.
To use it you will have to publish it on **npm**.
### Create a local provider
If you want create your own provider without publishing it on **npm** you can follow these following steps:
- You create a `providers` folder in your application.
- Create your provider as explain in the documentation eg. `./providers/strapi-provider-upload-[...]/...`
- Then update your `package.json` to link your `strapi-provider-upload-[...]` dependency to the [local path](https://docs.npmjs.com/files/package.json#local-paths) of your new provider.
```json
{
...
"dependencies": {
...
"strapi-provider-upload-[...]": "file:providers/strapi-provider-upload-[...]",
...
}
}
```
- Finally, run `yarn install` or `npm install` to install your new custom provider.