Skip to content

hayes/unpm-s3-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

μ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

About

s3 backend for unpm

Resources

License

Stars

Watchers

Forks

Packages

No packages published