keystonejs / keystone-storage-adapter-s3

⚠️ Archived - Legacy S3 Storage Adapter for KeystoneJS
MIT License
17 stars 56 forks source link

Digital Ocean Spaces support? #41

Closed Twansparant closed 5 years ago

Twansparant commented 5 years ago

Hi there,

I'm trying to use the keystone-storage-adapter-s3 for my File field with my S3 Digital Ocean Spaces, but no matter what I try, I keep on getting Field errors when trying to save my model...

import keystone from 'keystone';
const Types = keystone.Field.Types;

const s3Storage = new keystone.Storage({
    adapter: require('keystone-storage-adapter-s3'),
    s3: {
        // endpoint    : 'ams3.digitaloceanspaces.com',
        key         : process.env.S3_KEY,
        secret      : process.env.S3_SECRET,
        bucket      : process.env.S3_BUCKET,
        region      : process.env.S3_REGION, // -> ams3
        path        : 'uploads',
        uploadParams: {
            ACL     : 'public-read',
        }
    },
    schema: {
        bucket: true,
        etag  : true,
        path  : true,
        url   : true
    }
});

const MyModel = new keystone.List('MyModel ', {
    map: {
        name: 'title'
    }
});

MyModel.add({
    fileUpload: {
        type        : Types.File,
        label       : 'Upload file',
        storage     : s3Storage,
        initial     : true,
        required    : true
    }
});

Is this adapter not compatible with other endpoints then AWS? I found this post that I have to set the endpoint: https://www.digitalocean.com/community/questions/how-to-use-digitalocean-spaces-with-the-aws-s3-sdks

But I don't find any reference to that In the adapter's code anywhere? Thanks!

Twansparant commented 5 years ago

I ended up making my own fork which works with Digital Ocean Spaces: https://www.npmjs.com/package/@booreiland/keystone-storage-adapter-s3