sanity-plugin-s3-files
Version:
Store Sanity media files in AWS S3
49 lines (48 loc) • 1.44 kB
JavaScript
import { LockIcon, PinIcon, TrashIcon, EyeClosedIcon, EarthGlobeIcon, FolderIcon, } from '@sanity/icons';
export const schemaConfig = {
title: 'Media file hosted in AWS S3',
customFields: ['key', 'bucket', 'region'],
};
export const credentialsFields = [
{
name: 'bucketKey',
title: 'S3 bucket key',
icon: LockIcon,
type: 'string',
validation: (Rule) => Rule.required(),
},
{
name: 'bucketRegion',
title: 'S3 bucket region',
icon: EarthGlobeIcon,
type: 'string',
validation: (Rule) => Rule.required(),
},
{
name: 'getSignedUrlEndpoint',
title: "Endpoint for getting S3's signed URL",
icon: PinIcon,
type: 'url',
validation: (Rule) => Rule.required(),
},
{
name: 'deleteObjectEndpoint',
title: 'Endpoint for deleting an object in S3',
icon: TrashIcon,
type: 'url',
validation: (Rule) => Rule.required(),
},
{
name: 'folder',
title: 'Folder in Space',
description: "Folder to store files inside the bucket. If none provided, will upload files to the bucket's root (optional)",
icon: FolderIcon,
type: 'string',
},
{
name: 'secretForValidating',
title: 'Secret for validating the signed URL request (optional)',
icon: EyeClosedIcon,
type: 'string',
},
];