unpm-s3-backend

0.1.1 • Public • Published

μnpm-s3-backend

store unpm meta-data and tarballs in s3

Example

var backend = require('unpm-s3-backend')
var unpm = require('unpm')
 
// Defaults
var options = {
  // passed to new aws.S3(params) see aws documentation.
  s3: {params: {Bucket: 'no-default-bucket-set'}},
  baseUrl: 'https://s3-us-west-2.amazonaws.com/unpm-s3-backend-test/'
  users: {
    prefix: '~/users/'
    Bucket: 'user-bucket' // no default
  },
  meta: {
    prefix: ''
    Bucket: 'meta-bucket' // no default
  },
  store: {
    prefix: '~/store/'
    Bucket: 'store-bucket' // no default
  },
  tarballs: {
    prefix: ''
    Bucket: 'tarball-bucket' // no default
  },
}
 
unpm({backend: backend(options)}).server.listen(8000)

Example S3 bucket policy

allow installs even when unpm is not running

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "PublicReadForGetBucketObjects",
            "Effect": "Allow",
            "Principal": "*",
            "Action": "s3:GetObject",
            "NotResource": [
                "arn:aws:s3:::unpm-bucket/~/*",
                "arn:aws:s3:::unpm-bucket/~/"
            ]
        }
    ]
}

License

MIT

Package Sidebar

Install

npm i unpm-s3-backend

Weekly Downloads

0

Version

0.1.1

License

MIT

Last publish

Collaborators

  • hayes