How to use the @keystonejs/file-adapters.CloudinaryAdapter function in @keystonejs/file-adapters

To help you get started, we’ve selected a few @keystonejs/file-adapters examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github keystonejs / keystone / test-projects / basic / index.js View on Github external
const fileAdapter = new LocalFileAdapter({
  src: LOCAL_FILE_SRC,
  path: LOCAL_FILE_ROUTE,
});

let embedAdapter;

if (process.env.NODE_ENV === 'test') {
  embedAdapter = new MockOEmbedAdapter();
} else if (iframely.apiKey) {
  embedAdapter = new IframelyOEmbedAdapter({ apiKey: iframely.apiKey });
}

let cloudinaryAdapter;
try {
  cloudinaryAdapter = new CloudinaryAdapter({
    ...cloudinary,
    folder: 'avatars',
  });
} catch (e) {
  // Downgrade from an error to a warning if the dev does not have a
  // Cloudinary API Key set up. This will disable any fields which rely
  // on this functionality.
  console.warn(e.message);
}

keystone.createList('User', {
  fields: {
    name: { type: Text },
    email: { type: Text, isUnique: true },
    dob: {
      type: CalendarDay,
github wesbos / advanced-react-rerecord / sick-fits-keystone / models / Item.js View on Github external
import {
  Text,
  CloudinaryImage,
  Integer,
  Relationship,
} from '@keystonejs/fields';

import { CloudinaryAdapter } from '@keystonejs/file-adapters';
import { byTracking, atTracking } from '@keystonejs/list-plugins';

const cloudinaryAdapter = new CloudinaryAdapter({
  cloudName: process.env.CLOUDINARY_CLOUD_NAME,
  apiKey: process.env.CLOUDINARY_KEY,
  apiSecret: process.env.CLOUDINARY_SECRET,
  folder: 'sick-fits-keystone',
});

export default {
  fields: {
    name: { type: Text, isRequired: true },
    description: { type: Text, isMultiline: true },
    image: { type: CloudinaryImage, adapter: cloudinaryAdapter },
    largeImage: { type: CloudinaryImage, adapter: cloudinaryAdapter },
    price: { type: Integer },
    user: {
      type: Relationship,
      ref: 'User',

@keystonejs/file-adapters

Adapters for handling storage of the File type

MIT
Latest version published 3 years ago

Package Health Score

60 / 100
Full package analysis

Similar packages