45 lines
1.2 KiB
JavaScript
45 lines
1.2 KiB
JavaScript
module.exports = ({ env }) => {
|
|
const serviceAccount = JSON.parse(atob(env("GCS_SERVICE_ACCOUNT")));
|
|
|
|
return {
|
|
upload: {
|
|
config: {
|
|
provider:
|
|
"@strapi-community/strapi-provider-upload-google-cloud-storage",
|
|
providerOptions: {
|
|
bucketName: env("GCS_BUCKET_NAME"),
|
|
publicFiles: true,
|
|
uniform: false,
|
|
gzip: true,
|
|
serviceAccount: {
|
|
...serviceAccount,
|
|
private_key: serviceAccount.private_key
|
|
.split(String.raw`\n`)
|
|
.join("\n"),
|
|
},
|
|
basePath: "",
|
|
},
|
|
},
|
|
},
|
|
publisher: {
|
|
enabled: true,
|
|
config: {
|
|
hooks: {
|
|
beforePublish: async ({ strapi, uid, entity }) => {
|
|
console.log("beforePublish");
|
|
},
|
|
afterPublish: async ({ strapi, uid, entity }) => {
|
|
console.log("afterPublish");
|
|
},
|
|
beforeUnpublish: async ({ strapi, uid, entity }) => {
|
|
console.log("beforeUnpublish");
|
|
},
|
|
afterUnpublish: async ({ strapi, uid, entity }) => {
|
|
console.log("afterUnpublish");
|
|
},
|
|
},
|
|
},
|
|
},
|
|
};
|
|
};
|