From da12feccbea76ed8e94a090e9504da8c1ffa8fee Mon Sep 17 00:00:00 2001 From: Joris Berthelot Date: Wed, 6 Dec 2023 22:20:46 +0100 Subject: [PATCH] Add manual integration testing --- Dockerfile.test | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 13 +++++++++++++ index.js | 7 ++++--- 3 files changed, 65 insertions(+), 3 deletions(-) create mode 100644 Dockerfile.test diff --git a/Dockerfile.test b/Dockerfile.test new file mode 100644 index 0000000..affc90d --- /dev/null +++ b/Dockerfile.test @@ -0,0 +1,48 @@ +FROM ghost:5-alpine as cloudinary +RUN apk add g++ make python3 +COPY --chown=node:node . /tmp/ghost-storage-cloudinary +RUN su-exec node yarn add file:/tmp/ghost-storage-cloudinary + +FROM ghost:5-alpine +COPY --chown=node:node --from=cloudinary $GHOST_INSTALL/node_modules $GHOST_INSTALL/node_modules +COPY --chown=node:node --from=cloudinary $GHOST_INSTALL/node_modules/ghost-storage-cloudinary $GHOST_INSTALL/content/adapters/storage/ghost-storage-cloudinary +ENV DEBUG="ghost:*,ghost-config,ghost-storage-cloudinary:*" +ARG CLOUDINARY_URL +ENV CLOUDINARY_URL=${CLOUDINARY_URL} +ENV NODE_ENV=development +COPY <. + --- Many thanks to @[mmornati](https://github.com/mmornati), @[sethbrasile](https://github.com/sethbrasile) and all other contributors for their work. In the continuation of this project, don't hesitate to fork, contribute and add more features. diff --git a/index.js b/index.js index b90539e..cd31410 100644 --- a/index.js +++ b/index.js @@ -101,16 +101,17 @@ class CloudinaryAdapter extends StorageBase { return new Promise((resolve, reject) => cloudinary.uploader.upload(imagePath, options.upload, (err, res) => { if (err) { - debug('uploader:error', err); + debug('cloudinary.uploader:error', err); return reject(new errors.CloudinaryAdapterError({ err: err, message: `Could not upload image ${imagePath}` })); } - if (url) { - debug('uploader:url', url); + debug('cloudinary.uploader:res', res); + + if (url) { return resolve(cloudinary.url(res.public_id.concat('.', res.format), options.fetch)); } return resolve();