2

I see examples referencing a few parameters for the S3 storage driver for GunDB that look like this:

var Gun = require('gun');
var gun = Gun({ 
    file: 'data.json',
    s3: {
            key: '', // AWS Access Key
            secret: '', // AWS Secret Token
            bucket: '' // The bucket you want to save into
    }
});

I don't see a parameter to define a subdirectory/path within the S3 bucket, to facilitate sharing the bucket with non-GunDB data. Is there such an option/parameter?

Giacomo1968
  • 25,759
  • 11
  • 71
  • 103
hillct
  • 33
  • 5
  • Can’t seem to find an answer, but it appears that GunDB uses [Knox](https://github.com/Automattic/knox) as an Amazon S3 client. Might be worth digging around to see of there are any options related to Knox that would work with GunDB. – Giacomo1968 Dec 07 '16 at 00:28

1 Answers1

1

@hillct there is an option called prefix, thank you for pointing out that the options aren't documented. Here is how to use it:

var Gun = require('gun');
var gun = Gun({ 
    file: 'data.json',
    s3: {
            key: '', // AWS Access Key
            secret: '', // AWS Secret Token
            bucket: '', // The bucket you want to save into
            prefix: 'gun/'
    }
});

And just in case, here are some of the other options:

{
  throttle: 15 // Throttle writes to S3 in 15 second intervals, keeps S3 API costs down.
  batch: 10 // Or if there are more than 10 things in queue, don't wait.
}
marknadal
  • 7,534
  • 4
  • 25
  • 22