-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
38 lines (31 loc) · 821 Bytes
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env node
var nconf = require('nconf');
var toS3 = require('couchdb-to-s3');
var cred = require('./lib/cred.js');
nconf.file('dev', 'config-dev.json').argv().env().file('config.json');
nconf.defaults({
"dbUrl": "http://localhost:5984",
"dbName": "database",
"s3BucketName": "bucket",
"awsCredentialsPath": ".aws/credentials"
});
var awsCred = cred(nconf.get('awsCredentialsPath'));
var db = {
url: nconf.get('dbUrl'),
name: nconf.get('dbName')
};
var aws = {
accessKeyId: awsCred.aws_access_key_id,
secretAccessKey: awsCred.aws_secret_access_key,
bucket: nconf.get('s3BucketName')
};
toS3(db, aws, function (err, body) {
if (err) {
console.log("FAILURE");
console.log(err.message);
console.log(err.error);
return;
}
console.log("SUCCESS");
console.log(body.response.headers);
});