strapi-supa-storage-provider
v1.0.36
Published
Supabase storage provider for Strapi v4 upload plugin
Downloads
67
Maintainers
Readme
Strapi Upload Provider for Supabase storage
This is further forked from strapi-provider-upload-supabase-v4, since the original author has not updated the package to support Node 18.x. We might not able to maintain this package in the future, so please use it at your own risk.
This provider is a fork of shorwood's strapi upload provider digitalocean for Digital Ocean spaces, but applied to Supabase storage
Parameters
- apiUrl : Supabase API Url
- apiKey : Supabase API Key
- bucket : Supabase storage bucket
- directory : Directory inside Supabase storage bucket
- options : Supabase client additional options
How to use
- Install this package
npm i strapi-provider-upload-supabase-v4
- Create config in
./config.js
with content
module.exports = ({ env }) => ({
// ...
upload: {
config: {
provider: "strapi-provider-upload-supabase-v4",
providerOptions: {
apiUrl: env("SUPABASE_API_URL"),
apiKey: env("SUPABASE_API_KEY"),
bucket: env("SUPABASE_BUCKET"),
directory: env("SUPABASE_DIRECTORY"),
options: {},
},
actionOptions: {
upload: {},
uploadStream: {},
delete: {},
},
},
},
// ...
});
- Create
.env
and add to them
SUPABASE_API_URL="<Your Supabase url>"
SUPABASE_API_KEY="<Your Supabase api key>"
SUPABASE_BUCKET="strapi-uploads"
SUPABASE_DIRECTORY=""
- Create middleware in
./middlewares.js
with content
module.exports = ({ env }) => [
"strapi::errors",
{
name: "strapi::security",
config: {
contentSecurityPolicy: {
directives: {
"default-src": ["'self'"],
"img-src": ["'self'", "data:", "blob:", env("SUPABASE_API_URL")],
},
},
},
},
"strapi::cors",
"strapi::poweredBy",
"strapi::logger",
"strapi::query",
"strapi::body",
"strapi::session",
"strapi::favicon",
"strapi::public",
];
with values obtained from this page:
https://app.supabase.io/project//settings/api
Parameters options
, bucket
and directory
are optional and you can omit it, they will take the values shown in the example above.