Store your Strapi uploads on Google Drive
MIT License
Store your Strapi uploads on Google Drive
This plugin is meant to store the content of your medialibrary on Google Drive. While accessed those files are copied locally to avoid massive slow calls on the Google Drive API. This allows to spawn Strapi instances not having persistent storage for free.
upload-local
provider as long as they are cached locally (by default in /uploads/drive
)yarn add git:https://github.com/jclaveau/strapi-provider-upload-google-drive.git
(Npm package will come once ready)
Update your config/plugins.js
to look like:
module.exports = ({ env }) => {
return {
'upload-google-drive': {
enabled: true,
},
upload: {
config: {
provider: 'strapi-provider-upload-google-drive',
},
},
}
}
And add the following middleware at the end of your config/middlewares.js
:
'plugin::upload-google-drive.uploadsPath',
Then go to your admin panel > setting > Uploads
on Google Drive and follow the steps to populate the fields.
Each setting can be defined in the provider options so they can't be changed/seen in the settings page.
module.exports = ({ env }) => {
return {
'upload-google-drive': {
enabled: true,
},
upload: {
config: {
provider: 'strapi-provider-upload-google-drive',
providerOptions: {
// All those options are optional
dumpSettings: true, // Dumps current effective settings
displayConfigInSettings: true, // Do not hide settings defined in the provider configuration
clientId: env('GOOGLE_OAUTH_CLIENT_ID'), // Google OAuth client's id
clientSecret: env('GOOGLE_OAUTH_CLIENT_SECRET'), // Google OAuth client's secret
tokens: env('GOOGLE_OAUTH_CLIENT_TOKENS'), // Google OAuth tokens
driveFolderPattern: '/target_folder_on_drive', // Folder
},
},
},
}
}