This commit is contained in:
Jeremiah Orem 2014-06-09 17:13:36 -07:00
Родитель c4a380a9cd
Коммит c54686b97d
2 изменённых файлов: 16 добавлений и 5 удалений

Просмотреть файл

@ -28,6 +28,7 @@ awsSecretAccessKey = 'SomeSecretValue';
dynamodbTablePrefix = 'betafox.';
dynamoReadCapacityUnits = 1;
dynamoWriteCapacityUnits = 1;
awsS3CreateBucket = true;
awsS3PublicBucket = 'betafox-assets';
awsS3Region = awsDynamoRegion = 'us-west-1';
*/

Просмотреть файл

@ -20,13 +20,23 @@ exports.init = function(aConfig) {
});
if (config.awsS3CreateBucket) {
createBucket(config.awsS3PublicBucket, config.awsS3Region);
}
};
function createBucket(bucket, region) {
var params = {
Bucket: config.awsS3PublicBucket, // required
Bucket: bucket, // required
ACL: 'public-read',
CreateBucketConfiguration: {
LocationConstraint: config.awsS3Region,
}
};
if (region != 'us-east-1') {
params.CreateBucketConfiguration = {
LocationConstraint: region,
};
}
var s3 = new AWS.S3();
// 'http://{awsS3PublicBucket}.amazonaws.com/'
s3.createBucket(params, function(err, data) {
@ -36,7 +46,7 @@ exports.init = function(aConfig) {
console.log('Created S3 Bucket');
}
});
};
}
exports.save = function(iconPath, cb) {